In Versailles, France, during the 18th century, the royalty at a manor panic and run through the halls. King Louis storms into the chamber of Reinette and informs her that they are under attack by strange inhuman creatures. She tells him that the clock is broken and a man is coming who has watched her over her entire life. She sends the King on his way, and then kneels before the fireplace and calls out for the Doctor.
Three thousand years later, the TARDIS materializes aboard a spaceship. The Doctor, Mickey, and Rose emerge and the Doctor concludes that it is deserted. He activates the power and informs them that they're in the 51st century in a distant galaxy. The Doctor then notices that the warp drives are going at full capacity but they're not moving, and wonders where the power is going. The crew is also gone without explanation. They smell smoke and open a door to find an 18th century French fireplace, with nothing but outer space on the other side of the hull. The Doctor looks through the fireplace and sees a young girl, Reinette, on the other side. She informs them that she's in Paris in August the 18th century and goes to bed. The Doctor explains that there is some kind of hyper-spatial link powered by the warp drives.
The Doctor activates a switch and the fireplace swings around, transporting him to the 18th century. It is now winter and Reinette wakes up. She explains it was months since he last talked to her. He looks at a broken clock on the mantle and says he's scared because there's an unidentified ticking noise from something the size of a man. The Doctor realizes whatever is there deliberately broke the clock to conceal its presence. he looks beneath the bed and something grabs at him. It stands up, revealing it's a clockwork automaton. The Doctor realizes that it's scanning Reinette's brain, and it informs them that she is incomplete. It then advances on the Doctor, extending a clockwork blade. The Doctor backs up on the fireplace and activates the switch as the automaton advances on him. They are both transported back to the 51st century, and the Doctor freezes it with a fire extinguisher. He briefly examines its clockwork brain, but it teleports away before he can dismantle it. The Doctor goes back through the fireplace while Rose decides to go searching for the automaton and Mickey quickly goes along with her.
The Doctor finds himself with a much older Reinette, now in her late teens. He quickly realizes who she is and she is charmed to be reunited with her imaginary friend. Her mother calls her away for a trip and she kisses the Doctor before going. A manservant comes in and calls to Reinette by her last name, and the Doctor realizes that as an adult she is Madame de Pompadour, mistress to King Louis XI, and the Doctor just kissed her.
The Doctor returns through the fireplace and discovers Mickey and Rose have left. He walks down a corridor and finds a horse.
Mickey finds a visual scanner with a real human eye. Rose opens a nearby panel and finds a human heart wired into the system.
The Doctor goes looking for his companions and the horse follows him. He opens a door and finds himself on the grounds of a manor in Versailles. He spots Reinette and hides as she discusses the fact that the King requires a mistress, and she plans to meet him. The Doctor hides and Reinette seems to sense him, but continues on her way.
On the spaceship, Mickey and Rose continue searching for the automaton and find a window that looks in on King Louis XIV's chambers. The Doctor returns with the hors, and notes that there are deliberate time gates set up throughout the ship, all focused on Reinette. They watch as Reinette meets Louis for the first time. Behind her, the Doctor notices a broken clock. They watch as the automaton appears in the room. The Doctor, Mickey, and Rose come through the window and use the fire extinguishers to freeze the intruder. It starts to thaw out and the Doctor suggests that Reinette order it to answer the Doctor's questions. It explains that it is repair droid seven and they lack the parts to repair the ship. When the Doctor asks where the crew went, it insists that it didn't have the parts and the Doctor realizes it used the crew for repairs. He asks why it came to 18th century France, and it looks at Reinette and says one more part is required. However, it says that she's incomplete. When Rose asks why it chose Reinette, the automaton says they are the same. Reinette orders it to leave and it teleports away. The Doctor sends Rose and Mickey back to follow it, and then telepathically scans Reinette's mind to see what automatons want.
Back on the ship, more automatons attack Rose and Mickey and render them unconscious.
The Doctor scans her memories as she flirts with him. He realizes that she's 23 and warns her that she'll find herself reliving childhood memories. She is able to see his memories as well and realizes how lonely he is, and invites him to dance with her. When he refuses, she wonders who he really is and takes him away to dance.
Rose and Mickey wake up strapped to tables, and realize the automatons are going to chop them up. Mickey blames the Doctor for getting them into trouble. Rose tries to bluff her way out, warning them that the Doctor is a legendary being among the Daleks. The Doctor arrives, drunk and singing, and explains that the ship is 37 years old. When Reinette is 37, the automatons believe she will be suitable so her brain can be used as the ship's central control systems. He then pours a glass of wine into one automaton's head, short-circuiting it. He shuts down the automatons' main circuit and then starts shutting down all the time gateways. He discovers they won't close and a bell rings, signifying an incoming message. The Doctor realizes that there is one automaton in the past, and an automatic override prevents the shutdown of the gateways. The automatons reactivate and translate the message, confirming that Reinette is complete. They teleport away and the Doctor realizes they're going for Reinette's head.
Reinette is 32 and waiting in her room. Rose arrives and warns her that the automatons will arrive sometime when she is 37. She tries to explain about the spaceship and the gateways, and Reinette quickly understands what is going on. Rose tells her to keep the automatons talking so she can delay them until the Doctor arrives. When she notes that the automatons weren't supposed to change history, Reinette insists that it is for the best and that she is willing to tolerate monsters for the sake of an angel. Mickey arrives to tell Rose that they've found the proper time gate. Reinette quickly goes back through the gate and finds herself in the far future. They hear screams from her future time gate and her older self yelling about the broken clock. Reinette realizes she has to go back and live her life in sequence, and admits to Rose that she's afraid. However, she insists that the Doctor is worth the monsters, and then goes back to her proper time.
At Reinette's age of 37, the automatons advance on the partygoers as Reinette calls into the fireplace. The automatons arrive in Reinette's chambers and say that she is complete. In the future, the Doctor discovers that the automatons have blocked off the time gate.
In the past, the automatons have to take Reinette to the time gate in the ballroom because of the short range of their teleporter. In the future, the Doctor warns Mickey and Rose that they are part of events and can't use the TARDIS, and that it would take a truck to break through the gate. They watch as Reinette addresses the partygoers and tells them to act like Frenchman. She then tells the automatons that she has no intention of going with them. They prepare to cut off her feet, but Reinette tells them that she does not fear them, and their nightmare will plague them. They hear a galloping noise and everyone looks up as the Doctor bursts through a time gate mirror atop a horse. He dismounts and rips the mask off of one of the automatons, and tells it that it's over. The time gate has shattered and the Doctor realizes that they're trapped.
In the future, Rose and Mickey realize that the Doctor is stranded.
The Doctor informs the automatons that the link to their ship is broke and they don't have the parts. The automatons shut down since they have no purpose.
Rose looks out into space.
In the 18th century, the Doctor looks up at the sky as Reinette arrives. She realizes that he trapped himself deliberately to save her, and suggests he use one of the other doors. The Doctor explains that breaking the link broke it for all of the gates, and he wonders how he'll get along. Reinette points out that her "angel" will now have to travel the slow path. They share a drink and Reinette asks him to take her hand. She then leads him out to her bedroom where the fireplace is there. She had it moved from her childhood home. It's undamaged and the Doctor explains that it was offline when she moved it. Examining it, he finds an active connection and swings through to the other side. He calls back and invites her to come with him to the stars, and tells her to pick a star and be ready in two minutes. She runs to the window and looks up.
The Doctor reunites with Rose and Mickey and sends them to the TARDIS. He goes back to the fireplace and returns to the past, and finds Louis. He informs the Doctor that it has been years since they last met, and Reinette has gone on to Paris. The king gives the Doctor a letter from Reinette and goes to the window to watch her leave Versailles... in a hearse. She has died of illness. The Doctor puts the letter in his pocket and leaves the way he came.
Back in the TARDIS, the Doctor prepares to depart and Rose wonders why the automatons focused on Reinette. The Doctor admits that they'll never know, and it was probably a glitch in the ship's computers. The TARDIS will seal the time gates once and for all. When Rose wonders if he's okay, the Doctor insists that he's always all right. Once his companions have gone, the Doctor reads Reinette's letter. She speaks of growing weaker and hoping he'll soon come to her. The Doctor shuts down the fireplace via the TARDIS console
As the TARDIS departs, the travelers are unaware that the spaceship bears the name SS Madame de Pompadour
on its side.