Now, though, he is all but forgotten. He did not have long to play the elder statesman, pounding the lecture circuit or doing prestigious TV interviews: his galloping Alzheimer's disease, and the assault it made on his once-famed memory, put paid to that. He became a shambling, confused figure, spotted wandering on his own around the House of Lords, until his wife Mary finally took him off to his beloved Isles of Scilly. On an ITV1 documentary, whose first part aired last night, the journalist John Sweeney recalls seeing a familiar face on a Westminster park bench, sandwiched between two winos: it was the former PM, his eyes vacant.

Yet we should not let Wilson slip so easily into oblivion. Both his career, and the manner of its ending, have some useful lessons for today - ones that Tony Blair would do well to heed.

First, that resignation has never been fully explained. The ITV programme offers the personal, medical theory: Wilson could tell his brain was weakening, and rather than deny reality - as his Alzheimer's-afflicted mother had done - he resolved to quit while he was still on top. But that cause was almost certainly joined by another - one argued in tomorrow's BBC2 docudrama, The Plot Against Harold Wilson.

As Peter Wright confirmed in his book Spycatcher, Wilson was the victim of a protracted, illegal campaign of destabilisation by a rogue element in the security services. Prompted by CIA fears that Wilson was a Soviet agent - put in place after the KGB had, the spooks believed, poisoned Hugh Gaitskell, the previous Labour leader - these MI5 men burgled the homes of the prime minister's aides, bugged their phones and spread black, anti-Wilson propaganda throughout the media. They tried to pin all kinds of nonsense on him: that his devoted political secretary, Marcia Williams, posed a threat to national security; that he was a closet IRA sympathiser.

Such talk stoked up an establishment already trembling at what it saw as Britain's inexorable slide towards anarchy, if not communist rule. Institutions were collapsing, inflation was rising, tax was at a near-mythic top rate of 98%, and Britain was losing the last outposts of empire. Above all, the trade unions, riddled with leftists and Soviet sympathisers, seemed to have the nation under their thumb. "It was no longer a green and pleasant land, England," recalls retired Major Alexander Greenwood, Colonel Blimp made flesh.

The great and the good feared that the country was out of control, and that Wilson lacked either the will or the desire to stand firm. Retired intelligence officers gathered with military brass and plotted a coup d'etat. They would seize Heathrow airport, the BBC and Buckingham Palace. Lord Mountbatten would be the strongman, acting as interim prime minister. The Queen would read a statement urging the public to support the armed forces, because the government was no longer able to keep order.

It sounds fantastic, almost comic. But watch Greenwood talk of setting up his own private army in 1974-75. Listen to the former intelligence officer Brian Crozier admit his lobbying of the army, how they "seriously considered the possibility of a military takeover". Watch the archive footage of troop manoeuvres at Heathrow, billed as a routine exercise but about which Wilson was never informed - and which he interpreted as a show of strength, a warning, even a rehearsal for a coup. Listen to the voice of Wilson, who five weeks after resigning summoned two BBC journalists to tell them, secretly, of the plot.

Much of this has been known for a while; many of those involved have admitted as much and do so again in the BBC film. Yet officially it never happened: a 1987 inquiry under Margaret Thatcher concluded the allegations were false, implying that the fading Wilson had descended into paranoia. This can't be allowed to stand. Not only does it do an injustice to Wilson, it also represents an enormous cover-up. For this was the British Watergate, a conspiracy designed to pervert the democratic choice of the people. The circumstances of that time - mighty unions and the cold war - were entirely different. But if we are to learn the lessons of the Wilson plot, to realise what Britain's hidden powers are truly capable of, then these events deserve a proper reckoning. Blair should do a final service to the last Labour leader before him to win an election - and establish an independent inquiry.

In the process, he might realise how much the two have in common. The early Wilson, like the early Blair, was hailed as the harbinger of a new Britain, in touch with the mood, and the young people, of the age. Wilson gave MBEs to the Beatles, Blair gave tea to Noel Gallagher. Both were multiple election winners, skilful players of the media.

Still, historians may spot other, less comfortable parallels. First, both took heat for backing the US in an unpopular war: Wilson and LBJ in Vietnam, Blair and Bush in Iraq. Second, their reputations were badly muddied by sleaze - specifically alleged abuse of the honours system by handing out gongs and peerages to undeserving cronies. Third, they will both stir admiration for the electoral sorcery that produced winning streaks for Labour, but will both face a question: what legacy of substance did they leave behind?

If anything, these parallels are unfair to Wilson. He may have publicly backed LBJ, but privately he rejected the president's repeated request to lend even a symbolic British military presence to the war in Vietnam; Wilson refused to send so much as a marching band. Johnson punished him for it, but the PM held firm.

The Lavender List was a bad error, rewarding some, like Lord Kagan, who were later revealed to be corrupt. But Wilson did not sell peerages for cash, as Blair's Labour has done. In his day there was no need: his Labour party was funded by the trade unions, so did not need to go cap-in-hand to millionaires.

As for legacy, Wilson was mocked for citing the Open University as his greatest achievement: but that is an institution which has changed thousands of lives for the better. Along with facing down Ian Smith in Rhodesia, and steering Britain towards a Common Market yes vote in 1975, it's not such a bad record. Blair should reflect on it and pause: if his destiny is to be remembered for Iraq, he might prefer to suffer Wilson's recent fate - and be forgotten.

freedland@theguardian.com