In the year 5343, on the human colony of Mendorax Deliora, a servant named Nardole (Matt Lucas) mistakes the Doctor (Peter Capaldi) for a surgeon there to see the dying King Hydroflax (Greg Davies). His wife, River Song, (Alex Kingston) fails to recognize the Doctor after his latest regeneration. She takes the Doctor aside and asks him to decapitate the King because she wants the most valuable diamond in the universe, the Halassi Abdrovar, which is lodged in the King’s brain.

Hydroflax overwhelms them and, as a cyborg, he removes his head himself and orders his body to kill them. The Doctor grabs his head and threatens to drop it in the garbage disposal. River Song’s actual husband, Ramone (Phillip Rhys) teleports her, the Doctor, and the King’s head away. Hydroflax’s body decapitates the servant Nardole and uses his head.

River and Ramone track down the TARDIS and try to take off with the Doctor, but the TARDIS determines that the King’s head and body are still linked, and it refuses to leave. There is a homing beacon in the head, and the body forces its way inside, which causes the TARDIS to travel to the Starship Harmony and Redemption. River song asks the ship’s maitre d’, Fleming (Rowan Polanski), to deadlock seal the baggage hold with the TARDIS inside, to prevent Hydroflax’s body from finding them.

River intends to sell the diamond to a buyer named Scratch (Robert Curtis). After receiving payment, River and the Doctor find that Scratch and his people worship Hydroflax. The Doctor’s head is promised to Hydroflax’s body, using River as bait. The body, seeing his own death, destroys his head, leaving only the diamond. Fleming interrogates River about the Doctor, but she still doesn’t recognize him. She declares that the Doctor never loved her.

As a time-traveller, River knows the ship is about to be struck by a meteor, and she uses that to escape with the diamond. The Doctor overwhelms Hydroflax’s body and escapes, heading for the bridge. As the ship crashes, River learns that the ship will strike the planet Darillium. The Doctor knows this is where River will spend her last night with him before her death. They get to the TARDIS, but River is knocked unconscious.

The Doctor decides to bow to fate for once. After the crash, he gives the diamond to a man searching for survivors and tells him to build a fine restaurant with a view of the Singing Towers. He travels forward and books a table on the balcony, Christmas Day in four years’ time. They discover Hydroflax’s body, with Nardole’s head, working as a waiter. The Doctor gives River a sonic screwdriver. One night on Darillium lasts 24 years.

The episode and Alex Kingston won prizes at the 42nd Saturn Awards. River sees pictures of the Doctor’s 12 faces, which she recognizes, except for the latest one, but he was not supposed to have the last regeneration. Several previous episodes are mentioned. When he chides her on all her marriages, she mentions Elizabeth I, Cleopatra, and Marilyn Monroe. She has a red fez in her purse. They banter about spoilers, and he says, “Hello, Sweetie.” He complains that a flowchart is needed to follow their relationship, which she is living backwards, or is it the Doctor? In any event, many fans created such a flowchart. Matt Lucas as Nardole would become a companion later. Alex Kingston said she’d like to return later as 13th Doctor Jodie Whittaker’s wife. The opening credits feature snow and Christmas decorations. When the Doctor gives River the screwdriver, he waves it about a bit, recording her. This is why, a few years ago, Tenth Doctor,David Tennant was able to save her in the library computer in the Silence of the Library episode. This is another one of those paradoxes, in that he was able to save her only because he recorded her, and he recorded her only because he knew he would save her.