© 2017 The Authors. The Journal of Physiology © 2017 The Physiological Society Key points: Heart function is critically dependent upon the balance of energy production and utilization. Sarcolemmal ATP-sensitive potassium channels (KATP channels) in cardiac myocytes adjust contractile function to compensate for the level of available energy. Understanding the activation of KATP channels in working myocardium during high-stress situations is crucial to the treatment of cardiovascular disease, especially ischaemic heart disease. Using a new optical mapping approach, we measured action potentials from the surface of excised contracting rabbit hearts to assess when sarcolemmal KATP channels were activated during physiologically relevant workloads and during gradual reductions in myocardial oxygenation. We demonstrate that left ventricular pressure is closely linked to KATP channel activation and that KATP channel inhibition with a low concentration of tolbutamide prevents electromechanical decline when oxygen availability is reduced. As a result, KATP channel inhibition probably exacerbates a mismatch between energy demand and energy production when myocardial oxygenation is low. Abstract: Sarcolemmal ATP-sensitive potassium channel (KATP channel) activation in isolated cells is generally understood, although the relationship between myocardial oxygenation and KATP activation in excised working rabbit hearts remains unknown. We optically mapped action potentials (APs) in excised rabbit hearts to test the hypothesis that hypoxic changes would be more severe in left ventricular (LV) working hearts (LWHs) than Langendorff (LANG) perfused hearts. We further hypothesized that KATP inhibition would prevent those changes. Optical APs were mapped when measuring LV developed pressure (LVDP), coronary flow rate and oxygen consumption in LANG and LWHs. Hearts were paced to increase workload and perfusate was deoxygenated to study the effects of myocardial hypoxia. A subset of hearts was perfused with 1 μm tolbutamide (TOLB) to identify the level of AP duration (APD) shortening attributed to KATP channel activation. During sinus rhythm, APD was shorter in LWHs compared to LANG hearts. APD in both LWHs and LANG hearts dropped steadily during deoxygenation. With TOLB, APDs in LWHs were longer at all workloads and APD reductions during deoxygenation were blunted in both LWHs and LANG hearts. At 50% perfusate oxygenation, APD and LVDP were significantly higher in LWHs perfused with TOLB (199 ± 16 ms; 92 ± 5.3 mmHg) than in LWHs without TOLB (109 ± 14 ms, P = 0.005; 65 ± 6.5 mmHg, P = 0.01). Our results indicate that KATP channels are activated to a greater extent in perfused hearts when the LV performs pressure–volume work. The results of the present study demonstrate the critical role of KATP channels in modulating myocardial function over a wide range of physiological conditions.