Homer's Triple Bypass - S4-E11
Factual error: I get it, it's a comedy. But after open heart surgery, you are sedated for 1-2 days and on a ventilator. So, Homer even being awake after open heart surgery is completely false. Also, as someone who has had open heart surgery, you can barely move your chest because your sternum is fractured.
Answer: I'm not sure if this is the one you're thinking of, but an episode of "Ray Bradbury Theatre," called "A Sound of Thunder," dealt with a similar matter: a group of hunters travel back in time to hunt dinosaurs, only to find things have changed when they get back because someone stepped on a butterfly.
Xofer