With just 26 seconds left on the clock, Wales were condemned to a seventh straight defeat and a drop into the third tier of the world rankings ahead of Monday's 2015 World Cup draw.
Having come up short against the Wallabies three times during the summer, it looked as if four Leigh Halfpenny penalties to three from Kurtley Beale were going to give Wales a much-needed win.
For the first 15 minutes Australia dominated possession, although all they had to show for it was a long-range penalty from Beale.
But Leigh Halfpenny proved he could kick from distance too, and Wales gradually worked their way back into the match.
Wales came closest to scoring the first try of the game thanks to a break by Halfpenny - Toby Faletau just denied the score by an Australian hand getting the touch-down.
Wales were down 6-9 down at half time, but they kept up the forward momentum they'd built up into the second half and edged ahead thanks to the Halfpenny's boot.
It seemed the game was there to be won by Wales. But with time running out, Beale received Dave Dennis' inside pass to race over, break Welsh hearts and send Wallaby captain Nathan Sharpe into retirement on a high.
The game ended on a worrying note with Halfpenny receiving lengthy treatment before being carried off on a stretcher, having been hurt in the build-up to Beale's score.