Australia's Mike Harris kicked a penalty under huge pressure after the full-time siren to give the Wallabies a 25-23 win and break Welsh hearts in Melbourne on Saturday.
Harris' kick from the sideline - when the replacement had only been on the field for seven minutes - denied Wales a first win in Australia for 43 years, and secured the series for the Wallabies.
Australia will head to Sydney next week aiming to sweep the three-match series after winning the opening Test 27-19 in Brisbane last weekend.
The Welsh players hung their heads in despair after a gargantuan defensive effort to contain the Wallabies to just one try from Rob Horne, while crossing the line twice themselves through George North and Jonathan Davies. The lead changed hands time and again, with Australian man-of-the-match Berrick Barnes landing a conversion and five penalties, and Wales' Leigh Halfpenny kicking two conversions and three penalties.
The Six Nations champions had a dream start with left-winger North plunging over in the fourth minute next to the posts after early pressure.
Australia got more into the game with possession and territory but were made to work hard through multi-phase play before Barnes kicked two penalties, leaving the home side trailing by one point after 30 minutes. In one passage the Wallabies went through 18 phases, but the Welsh defence held firm.
Wales had a fine attacking moment of their own when scrum-half Mike Phillips bumped off three tackles before sending Rhys Priestland on his way, to elude Adam Ashley-Cooper but not escaping a tackle by prop Sekope Kepu.
The Wallabies finally cracked the resolute Welsh defence when Barnes dummied his way past centre Ashley Beck and sent Horne racing away to score, giving the hosts a 13-7 halftime advantage.
Four minutes after the resumption Wales pounced on an errant Will Genia pass from a lineout and Beck toed through for Jonathan Davies to win the chase and score a converted try for a 14-13 lead.
North was penalised for holding on a few minutes later and Barnes kicked the Wallabies back in front from wide out.
But in a see-sawing contest, Halfpenny nudged Wales ahead with a penalty after 51 minutes.
The Wallabies had another 15 phases inside the Welsh quarter before gaining the lead again with an offside penalty scored by Barnes.
Australia were reduced to 14 men when winger Cooper Vuna was yellow-carded for tackling Halfpenny in mid-air as the Welsh fullback leaped for a high kick. Halfpenny landed the penalty himself for Wales to lead again on the hour, only for Barnes to reclaim it back 22-20 with another three-pointer.
Again a Halfpenny penalty put Wales in front and within sight of a historic win, and Barnes missed for the first time in the match when he had a chance to put Australia ahead after a scrum penalty, going off immediately afterwards.
But as Australia pressed in the dying seconds the Welsh were penalised in a rolling maul, and Harris had the final say.