"The Caves of Androzani" was voted the greatest ever Doctor Who story in a 2009 fan poll, a poll I can't find myself putting too much stock in as it includes no stories from the first, second, or third Doctors' eras and it puts "Genesis of the Daleks" at three. "Genesis of the Daleks" had its moments, but mostly it was one of the most dismal war serials I've seen, and the war oriented serials are usually pretty dull. They rely a little too much on main characters miraculously surviving and running around hunched over in a rather less dangerous environment than they're trying to make us believe it is. And it's rare for the characters to run through heavy crossfire and even stop a moment to marvel they could've survived.
Anyway, "The Caves of Androzani" is really good, possibly my favourite fifth Doctor serial. And rather a pleasant surprise after a season that had started so badly. It's written by Robert Holmes, who was a regular writer in the third and fourth Doctor eras, and "Caves of Androzani" does have a retro feel, particularly in how the Doctor offers smart remarks to his captors. When he and Peri are informed of the nature of their upcoming "red cloth execution" the Doctor glumly yet dryly remarks, "Doesn't sound any more enticing than any other form of death."
Robert Holmes was one of my least favourite of the writers, actually, when he was a regular. When I saw his name in the opening, I got used to expecting a story where characters tended to do things with no real motive as plot points just sort of arbitrarily happened, as in "Terror of the Autons" or "The Deadly Assassin". But this is a case where he makes his big ideas work as just about everything is effective in "Caves of Androzani". I'd say only a fairly cheesy dragon monster with a scaly cape didn't work, and he only shows up very briefly. Most of the monsters in the serial are of the humanoid variety and, unlike in too many Doctor Who serials, it's not quite a manner of good guys versus bad guys. Usually a serial starts off establishing a hero and villain and sticks to them. On Androzani, it seems everyone's a villain and I rather liked how audience sympathy changed throughout. At first it seemed the General and his assistant were the heroes, despite trying to execute the Doctor and Peri, but then things switched to the rebel force of one, Sharaz Jek, who seemed to be sort of an ode to The Phantom of the Opera.
I think he's the show's first real anti-hero, and maybe the series was sort of leading up to him with sympathetic villains like Omega. Sharaz Jek's arch enemy is the government official Morgus--who's also secretly supplying Jek with weapons for his own cold-blooded ends via some also rather interesting cutthroat mercenaries.
With all these interesting, complicated subplots, the Doctor's story still manages to be the most interesting. As a regeneration episode, the writer has the freedom to kill the Doctor, an opportunity I don't think had really been utilized as well as it could have been in the previous regeneration stories. In this one, Holmes uses it for one of the most effective penultimate episode cliffhangers I've seen as the Doctor aims the mercenary ship at a planet. When the lead mercenary threatens to kill the Doctor if he doesn't stop the ship, the Doctor replies with just the right mix of cool and sort of resigned panic, "Not a very persuasive argument, actually, Stotz, because I'm going to die soon anyway." Interestingly, it's in this serial that I did start to see in Peter Davison a resemblance to Errol Flynn. And the Doctor's race against his death is made better by the fact that he's doing it more for Peri's sake--it would be admirable for the Doctor throw everything on the line for one of the companions he was close with, but when he's doing it for someone he barely knows and who still isn't very well established on the show, it goes to a whole other level of heroism and Davison sells it. Though I should say Nicola Bryant's American accent has gotten a bit better.
The final episode also featured one of the best desperate runs back to the TARDIS.