Peter Capaldi's soulful, wisecracking Twelfth Doctor said goodnight in the latest Doctor Who Christmas special, "Twice Upon a Time." And while past Christmas outings have found the Doctor fighting Inception-inducing space crabs, saving New York City with the help of a masked vigilante, and selling River Song's decapitated husband's head, "Twice Upon a Time" scaled back on the rip-roaring adventure, and zoomed in on four doomed souls contemplating their imminent deaths instead.

Merry Christmas!

Picking up where "The Doctor Falls" left off, Twelve bumped into the also-regenerating — well, the also trying not to regenerate — First Doctor (David Bradley, filling it for William Hartnell) in the South Pole. The men traded barbs and briefly contemplated choosing death instead of regeneration, but then time froze, and a World War I Captain (Mark Gatiss) teleported to them straight from an encounter with a German soldier in a foxhole, so the deep conversations about life and death would have to wait.

Doctor Who: Peter Capaldi and Steven Moffat Say Goodbye to Twelve

The three were transported inside Twelve's TARDIS (where we learned from the First Doctor that ours has been hiding a 1500 year-old liquor cabinet) to a spaceship hovered above, manned by a glass robot from a race called the Testimony. The Testimony gather the final confessions of the soon-to-be-dead; which conveniently described everyone in the robot's present company. In exchange for the Captain, who was about to die in the foxhole but sent to the South Pole instead of to Testimony, she delivered Twelve a human-again Bill Potts (Pearl Mackie).

The Doctor was hesitant to believe that it was truly her, and Bill's inability to remember how she'd gone from Cyberwoman to Heather's arms to his TARDIS again should tempered his excitement. But Twelve took Bill, the First Doctor, and the Captain with him on his next stop — the center of the universe, to consult Rusty from 2014's "Into the Dalek"'s Dalek hive mind database to locate the identity of the robots' creator — anyway, and Bill managed to extract both the First Doctor and the Captain's powerful, meditative final testimonies while Twelve poked around in Rusty's brain.

The Doctor then learned that the Testimony were a benevolent species, invented by a female doctor in the year five million to preserve human souls in robot form, essentially, after their deaths. This version of Bill was one of them, meaning she was still Bill — her memories and personality were intact — but the Bill Potts dwelling in England, in 2017, was still very much dead.

The Captain, resigned to his fate after his conversation with Testimony Bill, was then returned by the Doctors to his foxhole since they knew he could not avoid it. In a kind twist of fate, it ended up being the Christmas truce of 1914, and the Captain was revealed to be Captain Archibald Hamish Lethbridge-Stewart — a founder of UNIT, and Kate Stewart's ancestor. He lived to see many, many more days.

The First Doctor, also resigned to his fate after spending the episode grappling with his future as the "Doctor of War" (and saying era-appropriate, non politically correct sexist things to Bill throughout the episode; at one point he even threatened to "slap her bum") returned to his TARDIS to regenerate into the Second Doctor. And Twelve, alone at last with Testimony Bill, was given one last gift before he went off to die — his memories of Clara Oswald (Jenna Coleman), but also a hug from Nardole (Matt Lucas) because why not.

Twelve then returned to his TARDIS and monologued his final testimony — to always be kind, to laugh hard, run fast, and never say your name except to certain special little kids — before regenerating into a woman (Jodie Whittaker) for the first time in the 54-year history of this series.

We only got a few seconds of Thirteen (and one quote — "oh, brilliant") before she fell from the burning TARDIS, but with a new Doctor at the helm and executive producer Steven Moffat departing, it's an exciting time to be a Who fan. "Twice Upon a Time" may have been all about death, but here's to hoping Whitaker injects the aging (but still with it!) series with some new life.