Australia seemed set for an easy win in the series decider after going on a record rampage, with Ponting slamming a career-best 164 in a total of 434 for four, 36 runs more than the previous highest total in one-day internationals.
But in what Ponting described as "an amazing game of cricket," South Africa made 438 for nine, winning by one wicket with one ball to spare when Mark Boucher drove Brett Lee to the mid-on boundary.
Although he was named joint man of the match with Gibbs, the Australian captain was generous in defeat. "I'm pretty happy to hand it over to Herschelle," said Ponting. "He made 175 and was on the winning team. He deserves it more than me."
Ponting made his runs off 105 balls but Gibbs responded by making his 175 off 111 deliveries.
"It was one of the greatest days of our lives," said Ponting. "All credit to South Africa. We batted really well and posted an unbelievably big total but Herschelle and the boys were too good for us. It was a fitting end to a great series."
Smith was still stunned when he was presented with the series trophy, admitting his team "were a little bit down in the dressing room" after the Australian innings. "We knew it was a good wicket but 434 was a bit unrealistic."
Asked about the impact of the win, Smith said: "It's huge. We've got to come down to earth a bit. I don't really know what to say. At the moment all we really want to do is get back in the change room, have a beer or two and savour the moment."
It was by far the highest-scoring one-day match of all time, with the aggregate of 872 runs beating the 693 amassed between India and Pakistan in Karachi in 2003/04.
Both totals easily eclipsed the previous world innings best of 398 for five by Sri Lanka against Kenya in Kandy during the 1996 World Cup.
A capacity crowd of 32 000 roared South Africa to a 3-2 series victory after being stunned into silence by Australia's assault after Ponting won the toss and made first use of what proved a perfect batting pitch, with the batsmen aided by a fast outfield.
It was a batting display reminiscent of Australia's performance in the World Cup final against India at the same ground three years ago when Ponting made 140 not out in an Australian total of 359 for two. Australia went on to win by 125 runs.
Adam Gilchrist (55), Simon Katich (79) and Michael Hussey (81) made hard-hitting half-centuries as Australia dominated an attack missing star opening bowler Shaun Pollock, who suffered a back strain during the fourth match in Durban Friday.
South Africa's depleted attack started reasonably well and the total was only 13 in the fifth over when Gilchrist, on eight, was dropped by a diving Gibbs at backward point off Makhaya Ntini.
Gilchrist went on to a sparkling half-century off 35 balls as he and Katich put on 97 for the first wicket to set the platform for Ponting's sensational innings.
Ponting reached 50 off 43 balls, his 20th one-day international century off 71 balls and 150 off 99 deliveries. His innings included nine sixes - one more than he hit in the World Cup final - and 13 fours.
Every partnership was scored at better than a run a ball. Gilchrist and Katich made their 97 off 93 balls, the same number that were needed for the second wicket stand of 119 between Katich and Ponting.
The innings went into overdrive when Ponting and Hussey hit 158 for the third wicket off 96 balls.
South Africa lost opening batsman Boeta Dippenaar in the second over but Smith and Gibbs launched a full-scale assault in a second wicket stand of 187 off 127 balls.
Smith was out for 90, made off 55 balls, but Gibbs went on to make the highest score by any batsman in a one-day international against Australia.
He reached 50 off 46 balls, 100 off 79 balls and 150 off 100 before he chipped off-spinner Andrew Symonds to mid-off. His innings included 21 fours and seven sixes.
Gibbs was fourth out with the total on 299 in the 32nd over and for a while it seemed South Africa might stumble. But Boucher stayed at the crease and Johan van der Wath cracked 35 off 18 balls.
Number ten batsman Andrew Hall hit Lee for four off the second ball of the final over but was out next ball. Last man Makhaya Ntini nudged a single to third man before Boucher hit the winning runs.
Adding to a day of records, Australian medium-pacer Mick Lewis was hammered for 113 runs off ten overs, becoming the first man to concede 100 runs in a one-day international.