Western Australia 204 and 201 for 8 (Goodwin 47*, Doggett 4-61, Manenti 3-19) beat South Australia 192 and 212 (Manenti 66, Nielsen 51, Morris 3-44, Stobo 3-51) by two wickets
Jayden Goodwin and Corey Rocchiccioli produced a stirring ninth-wicket partnership late on day three as Western Australia overcame South Australia by two wickets in a nerve-jangling Sheffield Shield match in Perth.
Chasing 201 for victory on a grassy WACA surface, WA were on the cusp of a second straight defeat at 168 for 8. But Goodwin and Rocchiccioli defied the Redbacks' bid of a boilover with a calm, unbroken 33-run stand.
Rocchiccioli hit the running runs to spark jubilation in the terraces as WA bounced back from a horror trip to Sydney where they suffered big defeats to NSW in the Shield and the Marsh Cup.
"We discussed at tea that we were going to be positive and get it done today," said 21-year-old Goodwin, who finished unbeaten on 47 off 72 balls on his return to the side after replacing the injured Ashton Turner.
It was heartbreak for South Australia, who in their last match had beaten Queensland by three runs in a similarly tense finish.
After a dull draw between WA and Tasmania last month, the WACA surface was particularly spicy and just three half-centuries were struck in the low-scoring contest.
The Redbacks needed to strike with the new ball, which had accounted for clumps of wickets earlier in the match. But skipper Sam Whiteman and Cameron Bancroft looked unruffled as they chipped away at the target with a 39-run opening stand.
The match turned when Whiteman fell to a short delivery from Brendan Doggett, who shortly after banged a brutal delivery that thundered into Teague Wyllie's elbow.
After receiving medical attention, Wyllie retired hurt and a pumped-up Doggett was on a roll with the key wicket of Bancroft for 27. A visibly annoyed Bancroft trudged off having endured a rare sub-par match, having fallen for 20 to a rash cut shot in the first innings.
Doggett continued his spectacular spell when he had Hilton Cartwright caught behind to leave WA shakily placed at 58 for 3 at tea. Goodwin and Aaron Hardie decided to counter-attack after the break as they compiled 37 runs in quick time.
A desperate South Australia captain Jake Lehmann reverted to offspinner Ben Manenti for the first time in the innings, and the gamble worked with Manenti getting through Hardie's defences before Josh Philippe fell to Doggett in a rash stroke to extra cover.
When Manenti had Joel Paris chopping on to his stumps, the Redbacks could sense a famous victory with WA slumping to 105 for 6 and still 96 short with Wyllie's status uncertain.
But Charlie Stobo, who bats in the top four for his local grade club, hit a breezy 26 to swing the momentum WA's way before falling to Nathan McAndrew. In another twist, Wyllie returned to the crease having undergone a couple of rigorous net sessions in between.
He was peppered by short deliveries but showed no ill effects, and inched WA closer. Manenti again provided a pivotal breakthrough after Wyllie was trapped lbw failing to connect on a sweep shot.
WA's hopes would have sunk at that stage, but Goodwin and Rocchiccioli, who showed maturity in his 25 off 42 balls, came together as the shadows creeped on to the ground.
The gripping finale seemed unlikely when South Australia struggled to build a lead. But Harry Nielsen led a lower-order fight-back with a half-century and he was well supported by Manenti, who top-scored with 66 to lift the Redbacks to a lead of 200.
Manenti took the long handle to offspinning counterpart Rocchiccioli and smashed him for two sixes which landed in rubble amid the ground's redevelopment.
His cavalier 88-ball knock was ended by Lance Morris, who finished with 3 for 44 from 14.4 overs. Steadily building his bowling loads this season after a back injury, Morris was venomous on a hard surface and hit speeds of around 145 kph.
Paris shrugged off a groin niggle, which forced him off the ground late on day two. The injury-plagued Paris dismissed any possible concerns by dismissing McAndrew after coming into the attack an hour into the day's play.
The topsy-turvy contest continued until Rocchiccioli's winning boundary powered WA over the line and into top spot on the ladder.