Sylvester McCoy as The Doctor, currently in his seventh incarnation, transports the Master's remains from Skaro to Gallifrey in the TARDIS. The Master, who had already been tried and executed by the Daleks, lingers as a dangerous force, and en route the sealed container breaks open. The Master, now a snake-like ooze, escapes and infects the TARDIS, forcing a dramatic emergency materialisation in San Francisco's Chinatown on 30 December 1999.
After the sudden exit from the ship, the Doctor is shot by a gang that is pursuing Yee Jee Tso as Chang Lee, a young Chinese-American man. Lee calls for an ambulance and ferries the unconscious Doctor to a hospital, unaware that the ooze has boarded the emergency vehicle as well. At the hospital, the cardiologist, Daphne Ashbrook as Grace Holloway, begins a delicate surgery to stabilize the Doctor’s unusual heartbeat, baffled by his double-heart anatomy and the strange life forces coursing through him. Despite her best efforts, the Doctor apparently dies on the operating table, his body taken to the morgue while Lee quietly pockets the Doctor’s possessions. That very night, the Master seizes control of Bruce, the paramedic who was part of the ambulance crew.
The Doctor undergoes a regeneration, but his new form awakens with amnesia. He stumbles into Grace’s world, recognizing her only after a bewildering sequence of memories surfaces, convincing him that Grace is the one who failed to save him. Grace, having resigned from the hospital after the failed operation, takes him home to recover. Meanwhile, Bruce’s body—now inhabited by the Master—convinces Lee that the Doctor stole his original body, and presses him to open the Eye of Harmony inside the TARDIS, a procedure that requires a human retinal scan. When the Eye finally opens, the Doctor’s memories flood back and he realizes the Master is hunting him across time and space. He warns Grace that once the Eye is opened, the fabric of reality will begin to tear apart, potentially destroying Earth if they do not act before midnight on New Year’s Eve.
To avert catastrophe, they learn that an atomic clock is the key to stabilizing the process, and one rests on display at the San Francisco Institute of Technological Advancement and Research. The Doctor and Grace race to the Institute, retrieve the clock, and hurry back to the TARDIS. The Doctor carefully installs the clock and fights to seal the Eye, but the damage is already so deep that he must roll time back to before the Eye’s opening to prevent Earth’s doom. As he starts to rewire the vital circuits, the Master seizes Grace’s body again and knocks the Doctor unconscious.
The Doctor awakens to find himself chained above the Eye, the Master ready to drain his regenerations, while Lee and Grace watch in fear. He manages to show Lee that the Master has lied, revealing that the Doctor’s body is not his own, and Lee refuses to reopen the Eye. Enraged, the Master kills Grace, then forces her to finish the Eye’s final circuits and draw the Doctor’s lifeforce. Released from the Master’s control, Grace completes the sequence just in time to throw the TARDIS into a time-holding pattern and buy precious moments. The Master kills Grace, but the disruption buys enough time for the Doctor to break free and push the Master into the Eye. The Eye closes, and time reverses a few minutes, undoing Lee and Grace’s deaths.
With the immediate threat to Earth resolved, the Doctor prepares to depart. Lee returns the Doctor’s possessions and receives a warning to avoid San Francisco on the next New Year’s Eve. The Doctor offers Grace the chance to travel with him, but she politely declines and shares a farewell kiss before he retreats into the TARDIS. The ship hums back to life as the Doctor resumes his writing, the record player abruptly skipping once again, signaling that the next adventure will wait for another time.