Timely myocardial reperfusion salvages ischemic myocardium from infarction, whereas reperfusion itself induces cardiomyocyte death, which is called myocardial ischemia/reperfusion (MI/R) injury. Herein, β-carboline derivative 17c was designed and synthesized with obvious myocardial protective activity for the first time. Pretreatment of 17c effectively protected the cardiomyocyte H9c2 cells from H2O2-induced lactate dehydrogenase leakage and restored the endogenous antioxidants, superoxide dismutase (SOD) and glutathione peroxidase (GSH-Px). Besides, 17c effectively protected the mitochondria through decreasing the reactive oxygen species overproduction and enhancing the mitochondrial membrane potential. As a result, 17c significantly reduced the necrosis of cardiomyocytes in H2O2-induced oxidative stress, which was more potent than polydatin. In MI/R injury rats, 17c pretreatment obviously increased the levels of SOD and GSH-Px and inhibited the apoptosis of cardiomyocytes. Through this way, the size of myocardial infarction was significantly reduced after MI/R injury in vivo, better than that of polydatin, suggesting that 17c is a promising cardioprotectant for the prevention of MI/R injury.