Seven days after a humiliating home defeat against Georgia, Wales were cruising to victory with a 34-13 lead after 58 minutes.
But the injury-hit Wallabies somehow turned things around, scoring 26 unanswered points during the final 22 minutes as Wales captain Justin Tipuric and substitute hooker Ryan Elias were yellow-carded seven minutes apart.
But Australia, who were without the likes of key players Michael Hooper, Nic White and Taniela Tupou, delivered tries for hooker Folua Fainga’a and wing Mark Nawaqanitawase, before the winger added a second touchdown, while they also gained a penalty try before Lachlan Lonergan’s 79th-minute try sealed the comeback.
Fly-half Ben Donaldson kicked a conversion and two penalties, while Noah Lolesio booted two late conversions to leave Wales crestfallen.
Whether Pivac remains in charge heading into this season’s Six Nations Championship now looks unlikely, with Wales’ woes continuing just 10 months before the World Cup in France.
Pivac handed a Test debut to Ospreys centre Joe Hawkins, while world record cap holder Alun Wyn Jones made his first Wales start since March.
But a late injury blow saw full-back Leigh Halfpenny ruled out after he suffered a back spasm during the warm-up, so wing Josh Adams was promoted off the bench and handed the number 15 shirt.
Wales made a poor start, with lock Adam Beard dropping the kick-off, Australia dominating an ensuing scrum and Donaldson booting his team ahead through a third-minute penalty.
But the home side hit back impressively, as scrum-half Tomos Williams linked well with Jones, whose one-handed pass found Morgan, and he powered over for his third try in two Tests.
Anscombe converted, before Williams went off for a head injury assessment and was replaced by Kieran Hardy.
Donaldson and Anscombe exchanged penalties as Wales led 10-6 after the opening quarter, and there was an impressive momentum about Pivac’s team.
Australia then fell further behind following a slick handling move that ended in Faletau crossing wide out after he collected wing Dyer’s scoring pass.
Anscombe converted and added another penalty, putting Australia firmly behind the eight-ball as they trailed by 14 points midway through the second quarter.
Australia needed a response before the interval, and it arrived through a 33rd-minute try for Fainga’a after the Wallabies executed an impressive lineout drive.
Donaldson converted, but Australia had scrum-half Jake Gordon yellow-carded for deliberate offside following a sharp Dyer break.
Wales could not make them pay, though, with Hardy being held up over the line, and Australia trailed 20-13 at half-time.
Australia then briefly went down to 13 men when replacement prop Tom Robertson, who was on for Wallabies skipper James Slipper, received a yellow card following a scrummaging infringement.
And Wales made it count, driving a lineout at relentless pace, with Morgan claiming his second try and Anscombe’s conversion restoring a 14-point advantage.
Australia could not handle a rampant Welsh pack, and Dyer scored Wales’ fourth try, with Anscombe converting before he went off after suffering a nasty-looking shoulder injury.
But the game was turned on its head during a scarcely believable final quarter, with Nawaqanitawase’s second try prompting a Welsh collapse as Tipuric was sin-binned for a trip and Elias followed after he collapsed a maul that led to the penalty try.
And there was still time for Lonergan to win a game that was probably Pivac’s 34th and final Test in charge of Wales.