El Viaje Misterioso de Nuestro Homer (a.k.a. The Mysterious Voyage of Our Homer) - S8-E9
Trivia: When Homer starts tripping on the chili pepper, he sees a distorted vision of Ms. Crabapple and she makes "wah-wah-wah" noises when she talks. These are the same noises teachers are always making in Charlie Brown cartoons.
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