Introduction Immunosuppressive effects of general anesthesia and surgery could have unexpected consequences in a child with recent infection. The incidence of myocarditis in childhood is unknown. Case outline During general anesthesia for inguinal hernia repair, a seven-year-old boy suddenly developed heart failure. Clinical presentation included hypotension, pulmonary edema, drop in hemoglobin oxygen saturation, ST segment elevation and premature ventricular contractions. Homodynamic stability and adequate oxygenation were achieved with dopamine and furosemide. Preoperative history, physical examination and complete blood count were unremarkable. Moderate cardiomegaly and pulmonary edema were present on chest radiography. Diminished left ventricular contractility found on echocardiography increased troponin I and CK-MB levels suggested myocardial injury. Increased C-reactive protein with lymphocytosis suggested inflammation as its cause. Parents failed to report rubella 10 days before the operation. A clinical diagnosis of myocarditis as a complication of rubella was based on increased titer of IgM to rubella. With intravenous immunoglobulin, corticosteroids and symptomatic treatment for heart failure, his condition improved and ejection fraction reached 68 % one month after operation. Conclusion In future, we need protocols with instructions for pediatric patients undergoing elective surgery and anesthesia after viral infections.