The recent death of Elisabeth Sladen, best known for her role as Doctor Who's time travelling companion Sarah Jane Smith, prompted an extraordinary outpouring of grief from her peers and fans young and old.

And when it came to asking which story the BBC should repeat in her honour, the candidates seemed endless. Planet of the Spiders, when Sarah Jane first witnessed a regeneration, Pertwee bowing out with the seminal line, "a tear, Sarah Jane?" The bravehearted face-off against Davros in Genesis of the Daleks? Her eerie vulnerability in possession caper Pyramids of Mars? Instead BBC Four will repeat 1976 story The Hand of Fear tonight and tomorrow.

The four-parter holds all of those qualities that made Sarah Jane, and the woman who played her, so loved: the heart, the courage and the fragility. But it is of course most notable as being her final appearance in the classic series.

The Hand of Fear itself is a classic from the Hammer-inspired period, with the disembodied hand of ancient species Eldrad causing havoc in a nuclear power station, feeding off the radiation to grow back into its true form and attempting a standard enslavement attempt. But it's also among the strongest examples of its type: given the chance to film in a real nuclear plant (in 1976!), the producers could deliver expensive-looking wideshots, a world away from the wobbly sets of legend.

The adventure is notable for the ridiculous Andy Pandy outfit Sarah Jane had to wear, but when she is possessed (as happens rather often), the childish costume, coupled with a dead-eyed Sladen camping it up, declaring that "Eldrad must live!", means her porcelain face is every bit the killer dolly. It's vintage Sarah Jane.

It seems crazy now, but the original plan had been to kill Sarah Jane off, perhaps as a marker of how iconic the character had become. It was testament to how much affection had developed for Sladen that her request for that not to happen was met. It wouldn't be fair on the younger children, she reasoned. Neither did she want to be married off, as had happened to her predecessor, Katy Manning's Jo Grant. This wouldn't be true to the character, she figured, and her unspoken feelings for the Doctor.

So Sarah Jane's exit feels low-key, but no less powerful. It's a common criticism of old Doctor Who that the female characters are underwritten tropes who come and go like carousel horses. The worst thing you could say about Sarah Jane's exit is it maybe feels a little tacked on compared to the epic story arcs that greet companions nowadays. But Baker and Sladen rewrote the scripts themselves to deliver something fitting. Cold from the ice planet, grumpy at being possessed once too often, an exasperated Sarah declares that: "I'm going to pack up my goodies and go home!" Exasperated that the Doctor doesn't appear to be listening, bungling under the console, she storms off and does just that, demanding to return to south Croydon.

While she's off packing her goodies, the Doctor receives a summons to Gallifrey from the Time Lords, and "realises" that he cannot take a human to his home planet and Sarah must indeed depart. In many ways he's behaving appallingly. The audience didn't know at this point whether he was telling the truth (he never cared much for Time Lord custom in the past), or whether he had realised that he'd denied this woman a normal life for too long, and was breaking his own heart to do the right thing.

As the domestic turns serious, Sarah's face cracks, she claims she was only joking to get a rise, but they both know it's over. As ever with this extraordinary friendship, it's about what isn't said. They part with some platitudes about how "travel really does broaden the mind," and she scuttles off whistling, not imagining for a minute that she won't see him again for 30 years. A little sad, but striding off into the future whistling. This was Sarah Jane Smith.

We discovered the true emotional cost of what happened to Sarah, of the Doctor's alien misunderstanding of human emotion, when they were reunited in 2006, Sarah having been unable to ever truly move on. We also discovered that rather than south Croydon, he'd actually left her in Aberdeen. Sarah Jane's story eventually got its happy ending. For Elisabeth Sladen's rather mournful one, I can't think of a more suitable tribute.

• Doctor Who: Hand of Fear, will be on BBC4 at 7.40 and 8.05pm on Monday 9 May, and again on Tuesday 10 May