A Rob Horne try and Bernard Foley's subsequent conversion one minute from time gave Australia a 24-23 victory over South Africa in a rain-soaked Rugby Championship encounter in Perth.
The Wallabies trailed South Africa for much of the match but a 65th-minute yellow card for Bryan Habana, in his 100th Test, swung the game in the hosts' favour and their persistence paid off as the Springboks defence finally buckled in the closing stages.
The result, Australia's first win over South Africa in the Rugby Championship in four attempts, means they also have their first victory of this year's competition and will look forward to next Saturday's encounter against Argentina in the Gold Coast with renewed confidence.
A fortnight to reflect on a 51-20 defeat to New Zealand in Auckland saw Wallabies coach Ewen McKenzie replace Kurtley Beale with Foley at fly-half and the men in gold made a blistering start as full-back Israel Folau scored inside 90 seconds.
Inside centre Matt Toomua received quick ball from the breakdown, and having stepped inside opposite number Jan Serfontein, he offloaded to Folau who gathered the low pass to dive over.
Morne Steyn, also returning to the number 10 jersey in place of Handre Pollard, reduced the deficit to two points four minutes later when he kicked the first of his six penalties as the Wallabies were whistled by Irish referee George Clancy for not releasing.
Cornal Hendricks put South Africa into an 8-5 lead in the 13th minute, cutting inside from the right wing to touch down after the Springboks stretched the hosts' defence with some quick passing.
A marauding run by outside centre Tevita Kuridrani resulted in a penalty for the Wallabies which Foley duly converted to square the match at 8-8, but South Africa were in front immediately from the restart when the Wallabies gave away a needless penalty.
Steyn's second penalty of the match stretched South Africa's lead to 14-8 in the 25th minute, before Foley narrowed the gap to three points with his second penalty of the night shortly before the half-hour mark.
That proved to be the final score of the half as South Africa went into the interval with a 14-11 lead.
Foley hit back with a penalty two minutes after the restart to square the match at 14-14 before a scrambling Wallabies defence was forced to concede another penalty which Steyn kicked to return the Springboks into the lead.
The Stade Francais lynchpin then stretched his side's lead to 20-14 in the 49th minute after a collapsed scrum before he squeezed over his final penalty just after the hour-mark to stretch the visitors' lead to nine points.
The momentum then swung back in the hosts' favour when Habana was sin-binned for a high tackle with 15 minutes left on the clock and F oley reduced South Africa's winning margin to six points with his fourth penalty with 10 minutes to go.
With the clock ticking down to full time, a fine, one-handed offload from Folau found Kuridrani and he passed to Horne, who cut in from the left wing to score Australia's second try with less than two minutes to go before Foley held his nerve to slot the subsequent conversion to send the majority of those assembled in the Subiaco Oval into a frenzy.