Just for a moment, just for the sake of perspective, let's remember the famine before the feast.

Let's remember how Mark Cavendish, runaway favourite for the men's road race, trailed home in 29th place. How Hannah Miley could do no better than fifth in the women's 400 metre individual medley. How Rebecca Adlington, a double winner in Beijing, came up short, collecting bronze as France's Camille Muffat shattered the Olympic record ahead of her in the women's 400 metre freestyle.

Days went by, four in all, and still no British gold. Was it hubris? Was this the price for over confidence? Had we hopelessly underestimated the strength of other countries? Maybe the self-mocking of Danny Boyle's stunning opening ceremony wasn't so ironic after all.

And then the dam burst. First with a trickle, as Helen Glover and Heather Stanning delivered a dominant performance in the women's coxless pairs at Dorney Lake and Bradley Wiggins crushed the field in the men's road time trial through the streets of London, and then with a flood as the gold rush truly got under way.

This was how it was meant to be. All those preparations, all those predictions, all that lottery funding and all those targeted training schedules were finally bearing fruit. The next couple of days brought British golds for Tim Baillie and Etienne Scott in the men's slalom C-2 canoeing, and for Chris Hoy's sprint team at the London Velopark. There were more, still, in rowing and cycling. And the best was yet to come.

For those of us who struggle at times to explain why an interest in sport is a healthy obsession and not, as the American sociologist Thorstein Veblen wrote, the mark of the arrested development of man's moral nature, what happened in the Olympic Stadium on the evening of Saturday August 4 was something akin to a divine gift. In the space of 45 wildly improbable minutes, Jessica Ennis, Greg Rutherford and Mo Farah added three more golds to the British collection, and three more compelling reasons for taking an interest in such superficially ephemeral affairs and believing that they actually matter.

For Ennis, the heptathlon champion, it was a story of redemption. The daughter of a Jamaican painter-and-decorator father and a Derbyshire social worker mother, Ennis was distraught when she missed the 2008 Games with a fractured foot, but her smile lit up the country. Rutherford, who triumphed in the long jump, shot from obscurity with an almighty leap of 8.31m, Those who dismissed it as a freak effort overlooked the fact that his second-best jump, 8.21m, would have been good enough for the silver as well.

And then it was Mo's turn. There are few events in sport that have the dramatic potential of the three-act play that is a 10,000m race, and Farah played his part brilliantly. Boxed in and bullied for much of the race by the combined efforts of a posse of Kenyans and Ethiopians, the tiny 29-year-old, who came to Britain as an eight-year-old refugee from Somalia, produced one of the greatest finishes in athletics history, shaking off his tormentors when he broke from the front a lap from home and powered away to glory.

Great race. Great story. And that, in a nutshell, was what sport in 2012 seemed to be all about. It wasn't just that competition sorted out the best from the rest, or that the victors were all decent, wholesome sorts, or even that every winner triumphed against adversity; this was the year of the compelling sporting narrative. Just one bloody good story after another.

For anyone brought up on Alf Tupper and Roy of the Rovers, this was the year they had waited for. Sport can make itself devilishly unlovable at times, but its sins were forgotten as it restored itself in our affections. The good guys won heroically and in style. And one or two bad guys got their comeuppance as well.

Yes, it had its humdrum days as well. It was no year to be a Rangers fan, or to invest too much emotional capital in the performances of Scotland's football or rugby teams. In football, October losses to Wales and Belgium did for Scotland's World Cup qualifying chances and for manager Craig Levein; in rugby, head coach Andy Robinson took his leave in November with as much dignity as any man could summon after a humiliating loss to Tonga that plummeted Scotland to 12th in the world rankings, their lowest ever position.

Yet bad news stood out more for its rarity than anything else. It is hard to think of a year in sport that ever offered more uplifting moments than 2012 provided. There were great stories behind every one of the 29 gold, 17 silver and 19 bronze medals that Team GB harvested at the Olympics, and no sooner had the applause died down than the Paralympians took centre stage and did it all over again.

There was nothing patronising about the Paralympics. Conversations were not about how well this athlete or that athlete had done to overcome their disability, but of how they had beaten the bloke in the next lane or the woman on the other side of the net. So you've a disability? So what? Get out there and thrill us. And they did.

On four legs as well. Henry Cecil, the legendary trainer, had described Frankel as "the best horse I've ever seen" and the four-year-old lived up to that billing with a series of dominant performances, winning great races by distances that were almost embarrassing. Frankel retired – with a stud value conservatively estimated at £100m – in the autumn, with a record of 14 victories from 14 races run.

Goodness knows what Lionel Messi's stud value might be. For anyone who ever doubted the little Argentinian's right to be considered among the greats of football history, this was the year for keeping reservations under wraps, for Messi, still just 25, smashed the great Gerd Muller's long-standing goal-scoring record by netting 91 times in the space of 12 months. Moreover, he did it with the grace and humility that wearing the red and blue shirt of Barcelona demands. In a sport maligned for its grubby tendencies, Messi is a beacon as a person and as a player.

And yet, if Barcelona are the team of the age, the year will still be remembered for two games the Catalonians lost. Their defence of the Champions League foundered in the Nou Camp when Fernando Torres scored the last-minute goal that put Chelsea through to the final (which they won), while Celtic scored their most stunning victory in Europe when they downed the reigning champions 2-1 at Parkhead.

At Euro 2012, Spain, derided for being "too good" and possibly even "boring", did what everyone said couldn't be done and added a third straight major title in a thrilling 4-0 demolition of Italy in Kiev.

It was also the year of Andy Murray. Not because he beat Novak Djokovic in a five-set epic US Open final in September that exhausted Scotland's stock of midnight oil, or because he beat Roger Federer in a masterful three-set demolition to claim the Olympic title, but because he did both after losing to Federer in an emotionally charged Wimbledon final in June. When he broke down in tears in his after-match interview at Wimbledon, sport's professional chin-strokers concluded he lacked the inner steel to be a Grand Slam champion. How glorious it was to see them proved wrong.

The pundits didn't cover themselves in glory at Medinah, either. Towards the end of the second day, the USA led Europe 104, and the engravers were getting ready to etch Davis Love's name on the little gold trophy. But Sergio Garcia and Luke Donald grabbed a precious point against Steve Stricker and the hapless Tiger Woods to cut the deficit to five. Then came Ian Poulter.

Has matchplay golf ever produced a more thrilling passage than the five-birdie closing streak that Poulter, partnered by Rory McIlroy, delivered to win by one hole against Jason Dufner and Zach Johnson? Has there ever been a player more animated by the contest than Poulter? Bug-eyed, almost demonic, the Englishman rolled in putt after putt to close out the match. Europe still trailed by four points, but the wind and the momentum was with them.

And it carried them through that final day. A blue tide swept over the Medinah scoreboards, washing America out of the competition. It fell, at the end, to Martin Kaymer to seal victory, his one-hole win over Stricker securing the cup. Kaymer's form had been so bad in the build-up that it had been suggested he should withdraw. Like we say, one good story after another.

And the best of all was written by Bradley Wiggins. In the year that finally saw Lance Armstrong unmasked as the worst sort of cheat, Wiggins restored cycling's good name with his magnificent win, the first ever by a Briton, in the Tour de France. As an athlete, he was commanding. As a human being he was engaging. He was a marvellous sportsman: an extraordinary figure in a truly extraordinary year.