Wales were moments away from victory when Hoiles found his way to the try line on the right hand side. The home side's blushes were spared and Phil Waugh claimed victory in his first Test as captain.
"We were pleased to get the win there today, they pushed us very close," he said after the match.
Wales did indeed push them to the final whistle, a James Hook drop goal had the visitors one-point to the good as the match reached its final stages.
Wales had started brightly, and two turnover tries, first from Gareth Thomas and secondly from Jamie Robinson, gave them a 14-point lead. When Hook notched a penalty to put them 17 points to the good, the home fans were looking worried.
But the Aussies fought back with power tries from forwards Wycliff Palu and Nathan Sharpe which got them back into the game, and they ended the first half trailing by just five at 17-12.
Wales took the game to the Aussies in the second period and looked to have done enough to secure their first win on Australian soil since 1969, but when Hoiles crossed in injury time, that dream was dashed.
Australia: Tries: Palu, Sharpe, Giteau, Hoiles. Cons: Mortlock (3). Pen: Mortlock
Wales: Tries: G Thomas, Robinson. Cons: Hook (2). Pens: Hook (2). DG: Hook
Australia: Huxley, Gerrard, Mortlock, Ashley-Cooper, Mitchell, Norton-Knight, Giteau, Dunning, Moore, Shepherdson, Sharpe, Chisholm, Elsom, Waugh, Palu
Replacements: Gregan for Ashley-Cooper (66), Robinson for Dunning (53), Freier for Moore (73), Vickerman for Chisholm (67), Smith for Waugh (53), Hoiles for Palu (73). Not Used: Staniforth
Wales: Byrne, G. Thomas, Robinson, Parker, Czekaj, Hook, Phillips, I. Thomas, Rees, A. Jones, Cockbain, Sidoli, Charvis, G. Thomas, J. Thomas
Replacements: Henson for Robinson (67), Cooper for Phillips (72), C. Jones for I. Thomas (73), Hibbard for Rees (74), Owen for Cockbain (36). Not Used: Morgan, Sweeney
Referee: Jonathan Kaplan (SA)