The penultimate episode of TOS, All Our Yesterdays sees Kirk, Spock and McCoy beam down to the planet Sarpeidon, whose star is about to go nova. They discover signs of an advanced civilisation, but find only one inhabitant, a librarian named Atoz (Ian Wolfe). It transpires that everone else on the planet has been transported via a machine called the Atavachron, a time portal, and Atoz is concerned that Kirk and his pals haven't selected a period in the planet's past for their own relocation. By accident, Kirk is sent to a time period that resembles Earth circa the 17th century, while Spock and McCoy wind up in a frozen wasteland five thousand years ago.
The rest of the episode is all about returning to the present and hauling ass before the star explodes. A spanner is thrown in the works when Spock and McCoy encounter a beautiful woman, Zarabeth (Mariette Hartley), who has been exiled in the frozen past, and who seduces Spock (who is slowly reverting to the savage emotional state of his ancient ancestors).
A purely mindless, action-based story with no meaningful message or moral, this is one of the more enjoyable episodes of season three, with Kirk accused of witchcraft and Spock getting in a steamy clinch with Zarabeth (whose cave is heated by hot springs, meaning that she can saunter around her home in nothing but a skimpy animal skin bikini). Spock's dilemma: return to the Enterprise with McCoy, or get jiggy with a hot cave-girl. For a change, Kirk doesn't get the babe. We also get a tense race against the clock, our heroes escaping the past and the nova with seconds to spare.