Guardian of Forever incident

McCoy's alteration of history and its repair

After discovering the time portal called the Guardian of Forever, a delirious McCoy changed Earth's past, and Kirk and Spock went back to 1930 to restore history.

In 2267 the Enterprise traced powerful time distortions to an ancient planet where the crew found the Guardian of Forever, a portal able to show and open onto any moment in the past. McCoy, who had accidentally injected himself with an overdose of cordrazine, ran through the portal in a paranoid frenzy. At once the Enterprise vanished from orbit, and the landing party realized that history had changed.
Kirk and Spock followed McCoy to New York City in 1930. They found work and lodging at a mission run by Edith Keeler, a social worker with a hopeful vision of the future, and Kirk fell in love with her. Spock built a crude device to read his tricorder and discovered that McCoy had saved Keeler from a fatal accident, after which her peace movement delayed American entry into World War II and allowed Germany to win.
To put history right, Kirk had to stop McCoy from saving her, and Keeler was killed by a truck. The three men returned through the Guardian, the timeline was restored, and the portal remained one of the most important and dangerous discoveries of the era.