The most obvious thing to note about Heaven Sent is that it's the first time ever the lead actor has had the entire show to themselves (minus a brief appearance from Jenna Coleman and a child actor at the end). It's the sort of thing that can be done every so often, a tweak to the format to keep things interesting. It doesn't hurt to alter the audience's expectations either1.
It worked largely because of Peter Capaldi. Chris Eccleston could have done this but there was no way the programme could have been so experimental in its first series. David Tennant could have done this too, although his Doctor was written more to bounce off of other people and to enjoy showing off. And even his time on the show may have felt a little early to try it. Matt Smith could not have handled this, which makes me think that Moffat's had this story in his head for a while but waited until he had a lead actor who could do it justice2. I'm finding myself thinking that more the more I watch Capaldi and see the things he's given to do.
The episode ended up as a fifty-five minute example of why Peter Capaldi was cast as the Twelfth Doctor. He showed his impressive range. He showed his instinct for making interesting choices for how to play things. He showed his expressive body language and facial movements. Whether he was stepping out of the teleporter at the start (and the end) of the episode and placing his feet to suggest frailty and innocence or giving a knowing glance to the camera as he delivered the line "I'm nothing without an audience" he was pitching things perfectly. He gave a performance that was so nuanced and focused that he pretty much made it so that he has to be considered the best actor to have taken the lead role of New Who. Because nobody else has had the chance to show their ability in this way before.
Steven Moffat deserves credit too. Because he provided Capaldi with a script that let him be intelligent, funny, scared, angry and a bunch of other things. He also gave us his best new monster for a while, the originally-unnamed shuffling presence (later disappointingly named as the Veil) that hounded the Doctor through an otherwise empty castle. A faceless, unstoppable horror that can only be stopped with fresh truths is a very clever, very Doctor Who, very Steven Moffat idea. The same goes for the setting of a castle which can rearrange itself. That's not a new idea, of course, but it's something that's a good fit for this show and feels like it should have been seen more. It was the setting and the constant threat of the Veil that gave the episode a sense of urgency, something for Capaldi to react against in the absence of a proper supporting cast.
Moffat's other triumph was explaining how the Doctor copes with dangerous situations. He stays calm and imagines himself in the safety of the TARDIS, slowing things down and letting himself concentrate and think. It gave us a glimpse inside the Doctor's head but in a way that didn't reveal too much of the character and retained some of his much-needed mystery. It also made good use of the TARDIS set, an enormous expense that hasn't had much screen time this series.
Speaking of which, the production team deserve a mention at this point. They found a great location for the castle, created some good props to make it seem appropriately unknowable3, and put together an effective costume for the Veil. Interesting things were done with the lighting as the TARDIS "came back online" too. Everyone seemed to be working towards making this a memorable episode and they accomplished that goal.
The episode wasn't without its faults though. At the same time as he was doing his best writing yet for Capaldi's Doctor Moffat was also pumping out another looped timeline plot. These and the not dissimilar time paradoxes are amongst his most overused tropes. He's been using them since Blink and hasn't been sparing about it. Series six was bookended by this approach for example. It's reached the point now where it's to be expected. The moment I saw a gnarled, bloody hand pulling a lever at the beginning of the episode I knew it would turn out to be Capaldi because that's precisely the sort of thing Moffat does.
The other failure4 was that it was the Time Lords behind it all. On one hand, that's okay. The Time Lords have been built up since the reboot as an unknowable, god-like race whom the Doctor both misses and never wants to see return. They're an interesting concept to introduce to New Who5 for these reasons and it feels appropriate for them to return ten years on from the revival. And the reveal that the castle was inside the confession dial was a very nice touch, being unexpected and a nod towards the race's knack for bigger-on-the-inside technology.
On the other hand it was always going to be the Time Lords and Moffat didn't even try to hide it. A token attempt at not making it obvious would have been nice. Their return has been inevitable since they were brought back in The Day of the Doctor and it's an ill-fated decision. The Time Lords have always worked best when presented as a corrupt society of paranoid schemers desperate to cling to life and left mostly off-screen. The majority of JNT's term as producer bears me out on this. The trailer shows that we're going to see guns and armour. Lots of guns and armour. Using the Time Lords as Imperial storm trooper surrogates does them no favours but it's not a part of this episode, so it's not the problem that another time loop plot is.
This isn't the sort of episode that could be done every series, or even with every Doctor, but as a one off it absolutely works. The right actor got to do it.
1 By "the audience" I mean the portion of people who watch Doctor Who without gorging themselves on previews and spoilers first, because they're the ones who (probably) didn't' know this single-hander was coming, and I imagine it would have worked better without that foreknowledge.
2 Although I may be giving Moffles too much credit. Maybe Smith's era was shaped the way it was because he simply couldn't wait to write all those "clever" time travel plots and explain The Mystery of River Song™.
3 Yeah it was mostly big clockwork cogs, but what big clockwork cogs!
4 Aside from the script raising questions like "Why did the Veil touching the Doctor's face burn one side of the face but not the other, and why did it scorch the Doctor's clothes?"
5 Well, reintroduce, technically. RTD beat Moffat to it by several years, although it feels like Moffat intends to have the Time Lords return on a more permanent basis where Davies was happy to use them as a one-off, the ultimate threat in his Buffy-inspired Ever Bigger and Badder Big Bads approach to series finales.