City on the Edge of Forever, The
McCoy accidentally injects himself with an overdose of cordrazine, a drug which makes him exhibit signs of paranoia and madness, while treating an ailing Sulu on the Bridge. Delirious, he beams down to a nearby planet's surface, with Kirk and a landing party on his heels.
They are too late to stop the doctor from leaping through a living time machine called "The Guardian of Forever." At that moment, the U.S.S. Enterprise ceases to exist and the landing party is stranded. The Guardian explains that McCoy went back into Earth's history and changed it, thereby altering the future. Kirk and Spock go through the Guardian, to Depression-era America, a few days before McCoy is to arrive and change history.
They encounter a social worker, Edith Keeler, who helps them find work to pay for the equipment Spock requires to build a tricorder. Unknown to Kirk and Spock, Edith has taken in the recently-arrived and ill McCoy. Kirk promptly falls in love with Edith and is devastated when Spock completes his tricorder and discovers that in order to repair history, they must let Edith Keeler be killed in an auto accident. If they allow McCoy to save her — as he did before — she will start an effective pacifist movement that will delay the United States' entrance into World War II, thus allowing Hitler's Germany to develop the atomic bomb first and conquer the planet.
When the moment comes, a heartbroken Kirk stops McCoy from saving Edith, and the three officers journey back through the Guardian, where they find things as they should be again.