The most treasured memories in sport come from victories that are achieved when all seems lost. Cricket provides more such reversals of fortune than most games. That explains why Sir Ian Botham (oddly, the knighthood came for services to charity, not cricket) became probably the biggest hero, next to WG Grace and Sir Donald Bradman, in the game's history. With either bat or ball, he rescued seemingly hopeless causes three times against Australia in 1981, turning round a series in which England seemed certain to surrender the Ashes. He did it, moreover, when his own career seemed close to ruin. He had just relinquished the England captaincy after failing to win any of his 12 Tests in charge and completely losing both batting and bowling form. It was the sporting equivalent of a Hollywood movie where the hero is engulfed in a roaring blaze only to come unexpectedly to life and carry his beloved to safety.

Simon Wilde, in this perfectly paced and exhaustively researched biography, recalls the magic of that astonishing summer. But he doesn't neglect the darker side of Botham's career and character, revealing a more complex and nuanced personality than the gruff, self-confident exterior suggested. Botham's heroic status, Wilde points out, rested on three relatively brief passages of play in 1981, totalling less than four hours. They involved no great skill or subtlety, only a mysterious capacity – perhaps derived from his imposing physical presence and his almost maniacal self-belief – to reduce the opposition to gibbering wrecks. The great Australian fast bowler Dennis Lillee bowled like a village-green novice while Botham made centuries at Leeds and Manchester. At Birmingham, Botham's five, match-winning, second-innings wickets came from balls that appeared perfectly straight and not even particularly fast. The Australians just missed them.

One of cricket's virtues is that it is not only for people of differing shapes, sizes and skills but also for different personalities. Batsmen such as Geoffrey Boycott, who play steadily and carefully, and bowlers such as the late Alec Bedser, who pitch every ball on a good length, can save and win matches. But the more spasmodic, theatrical genius of a Botham – and, more recently, Andrew Flintoff – gets most vividly remembered and reaps the biggest rewards from the celebrity culture that was just beginning in 1981. Botham couldn't have timed his hour of glory better. Amid economic misery and urban riots, Britain was desperate for uplifting stories, preferably with a patriotic angle. The marriage of Charles and Diana provided one, Botham another.

After 1981, things often went as badly for Botham as for the royal couple. Though he could still turn in the occasional outstanding performance, his bowling declined in penetration and his batting in consistent judgment. Success against the West Indies, then the world's best team, eluded him. He neglected net practice, and allowed his weight to balloon. His 1981 successes encouraged the belief that, whatever he did, everything would come right in the end. After all, he scored 149 not out at Leeds from two hours of wild slogging because, as he put it to one batting partner, he didn't want to "hang around out here for two days". At Birmingham, he bowled only because his captain insisted. He didn't, he concluded, need to try that hard. As Wilde shrewdly observes, this working-class boy who went to a comprehensive and built his career on perspiration, became one of the last standard-bearers for the English public school amateur tradition, which regarded conspicuous effort as evidence of low breeding.

Unlike Flintoff – who flamboyantly ran out the Australian captain Ricky Ponting in his last Test – Botham didn't time his exit well. In his final match for England, a one-day international, he took no catches or wickets and scored no runs. He bowled his last delivery in first-class cricket, at the end of an inconsequential match for Durham against the 1993 Australian tourists, with his member hanging out of his trousers, an act which Wisden coyly described as "unbecoming and flippant". Even as England captain, he faced a court case on an assault charge (he was found not guilty) and, from the beginning, his alcohol consumption was prodigious. In his later years, the allegations of wild behaviour, including drug-taking and adultery, became more frequent, the great cricketing exploits less so.

Yet, in contrast to George Best, Alex Higgins and Paul Gascoigne, equally flawed geniuses from other sports, Botham never quite lost his heroic status – a considerable achievement in an age when sections of the media habitually follow the rules of classical Greek drama. Partly thanks to his long-suffering wife Kathy, he stopped well short of social and physical disintegration. Most importantly, he maintained his public image as the man who overcame impossible odds by undertaking long, arduous walks – from Land's End to John O'Groats, for example – to raise money for people with leukaemia.

It is possible to be cynical about his charity work. As a team-mate put it, "it became Botham the business rather than Botham the professional athlete" after 1981, and the walks were good marketing for the Botham brand. One should certainly be cynical about his claim, once made in a Sun column, that he refused to accept lucrative offers to join unofficial tours to apartheid-era South Africa because he wouldn't be able to look his friend and Somerset team-mate Viv Richards in the eye. As the Indian-born journalist Mihir Bose once tartly observed, "he had initially agreed to tour while gazing at Richards as they holidayed together in Antigua". His real concern was not to lose his commercial endorsements. As he claimed, he didn't put "cash before country"; he put more cash before less cash.

On balance, though, Botham deserves his comfortable after-life as a national treasure, chuntering in the Sky TV commentary box about how namby-pamby modern players fuss over injuries. He may be a fervent monarchist, a Tory voter with views, as one player unoriginally puts it, "to the right of Genghis Khan" and, in his single-minded go-getting, an emblematic figure of the Thatcherite high noon. But for a few years, he was the best cricketer in the world, giving pleasure and imperishable memories to millions.