Lisa's Rival - S6-E2
Trivia: When Homer's sugar melts, he says 'Melting. Melting, oh what a world.' This is exactly what the Wicked Witch of the West says when she melts in The Wizard of Oz (1939).
Lisa's Rival - S6-E2
Trivia: While Homer is guarding his sugar and sleeping outside, Marge nudges him to wake him up and he says in his sleep, "In this country, first you get the sugar, then you get the money, and then you get the woman." This is almost a direct quote from Al Pacino's movie Scarface in which he tells his best friend, "In this country, first you get the money, then you get the power and then you get the woman." Homer even says it in a similar accent.
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