A try two minutes from time from winger Tom Lineham gave Warrington a dramatic 22-20 Betfred Super League victory over Wakefield to stretch their unbeaten run to five matches.
The Wolves looked to be heading to defeat but staged a spectacular second half comeback to claim an important win at the Halliwell Jones Stadium and close the gap on seventh-placed Trinity to just one point in the race for the top eight.
Wakefield looked to be on their way to a comfortable victory as they led 20-6 early in the second half.
However, the visitors succumbed to a late Wolves rally as tries by Chris Hill and Kevin Brown set up a frantic finish that saw Lineham's spectacular dive in the corner win it for the Wolves in the dying stages.
Ryan Atkins claimed Warrington's other try, with Declan Patton landing three goals.
Ashley Gibson, Mason Caton-Brown and Tom Johnstone claimed tries for Wakefield, with Liam Finn landing four goals.
The Wolves were without suspended duo Ben Westwood and Daryl Clark and Mike Cooper also missed out after picking up a knock against Huddersfield on Easter Monday. However, they welcomed back Atkins, Joe Westerman and Brown into the squad.
Max Jowitt came in at full-back for Trinity in place of Simon Grix and James Batchelor was on the bench as Mitch Allgood and Matty Ashurst were missing from the side that narrowly lost to Wigan on Monday.
The visitors made a dream start, hitting their hosts with two tries in two minutes to take an early 12-0 lead within the first nine minutes.
They opened the scoring on seven minutes when Finn saw his kick on the last tackle deflected perfectly into the path of Kyle Wood, who then kicked ahead for Gibson to touch down.
And in the their very next set Jacob Miller broke from deep and the supporting Caton-Brown was on hand to take the stand-off's pass to score under the posts. Finn converted his second try.
The Wolves recovered from their shaky start and applied plenty of pressure but could not find a way through a gritty Wakefield defence - and when they did Atkins saw his effort from a kick ruled out by the video referee for offside.
But the home side finally registered their first points midway through the first half when Patton and Stefan Ratchford combined to send Atkins clear from deep and the centre raced 80 metres - bumping off Wakefield full-back Jowitt in the process - for a spectacular long range try which Patton converted to make it 12-6.
Tom Johnstone had a try ruled out by the video referee for a knock on before Finn landed a penalty late in the half to give Wakefield an eight-point advantage at the break.
The visitors made the perfect start to the second half when Millar's excellent floated pass gave Johnstone the space to score six minutes after the restart. Finn converted to make it 20-6.
Wolves skipper Chris Hill gave his side hope of a comeback when he powered his way through four attempted tackles to crash over and Patton's conversion cut the deficit to eight points again.
And with 11 minutes remaining Warrington set up a tense finale when Brown dummied his way over from close range to score - Patton again goaled to make it 20-18.
Then with less than two minutes remaining it was heartbreak for Wakefield as Ratchford's long pass gave Lineham space to race down the touchline and settle the contest.