Wigan survived a frantic finish to secure their place in the Challenge Cup semi-finals.
Returning stars John Bateman and Sam Tomkins had scored late to put Wigan 27-20 ahead of a tense, if error-strewn, derby.
But Kurt Gidley’s late try, converted by Dec Patton, reeled in their lead to a fragile one-point.
And when Joe Burgess booted the restart out on the full, it gave the Wolves a penalty to take the lead - but Stefan Ratchford’s attempt was wide.
The hosts still had time to mount a late raid on the Warriors’ line, but Shaun Wane’s side hung on to claim a gutsy and confidence-boosting victory.
The epic finish followed an error-littered display. Both sides were poor, for different reasons.
Warrington were slow and lacked attacking options. On those fronts, Wigan were better - but their discipline and errors frequently let them down.
Still, after five games without a win, it was a much-needed and ultimately-deserved victory - not only in keeping their Wembley dreams alive, but in lifting some of the gloom.
And it was fitting that both Bateman and Tomkins played such vital roles in the final few minutes.
Indeed, all six who were primed to return - Tomkins, Bateman, Sean O’Loughlin, Anthony Gelling, Liam Farrell and Sam Powell - all featured. And their return meant Wane’s starting line-up featured 11 current or recent internationals.
The question, though, was whether they would be under-done by a lack of game-time.
Tomkins, in particular, hadn’t played since last September because of a broken foot, while Bateman (shoulder) was making his first appearance since the World Club Challenge in February.
Both answered that emphatically, playing the full 80-minutes and – while rusty on occasion – showed the qualities which have made them England internationals.
Warrington, who had the fabulously-named Will Dagger on the wing in only his second game, lost Kevin Brown minutes before kick-off to injury. He was replaced by Dec Patton, who kicked a perfect five goals from five before Ratchford took over for the late penalty-attempt.
And on goal-kicking, George Williams hit a perfect five – including three from difficult positions – to ease worries about that issue.
Wigan established an 18-12 lead by half-time but it was a patchy, error-littered display from the visitors. They had spells when they played with purpose, control and intensity, but far too often these were followed by drops which invited the hosts into their territory.
Wire weren’t much better - a sign of the baking heat, the stakes on offer or the nervousness in both sides right now.
Tomkins, inevitably booed by the home fans, made his presence felt early. He chimed into the line, linked with Oliver Gildart who - once again - did everything right to release Burgess for an 11th minute opening try.
Micky McIlorum made a couple of bone-jarring tackles before being rested, along with Sean O’Loughlin.
But without them, they powered ahead, the erratic Ryan Sutton and Joel Tomkins keeping the ball alive and Williams’ looping pass sent Burgess over.
Williams nailed a second difficult goal to make it 12-0. And they went close to extending their lead but Liam Marshall, playing on the right wing, just couldn’t collect a drilled kick from Thomas Leuluai.
Wigan were looking comfortable, but errors crept into their display, which invited Wire into their half. When they got there, they did little with ball-in-hand which troubled the defence; but when they resorted to kicks they had some success, Ryan Atkins plundering two tries in five minutes.
First, he leapt to collect Kurt Gidley’s angled kick, and later grounded a skidded short-ball from Patton. The halfback’s two goals locked the scores.
Wigan blew an early chance to respond, but chipped away at the Wire line, and crisp passes to the right released Marshall, who did well to wriggle out of Atkins’ tackle and score his eighth try against the Wolves this year.
On the stroke of half-time, the winger saved a try, bundling Tom Lineham into touch.
Ex-Warrior Jack Hughes surprisingly wasn’t sinbinned for taking Burgess out off the ball as he chased a freeplay kick through. Errors continued to blight Wigan’s display, but a raking 40-20 by Powell set-up the position for Williams to kick a penalty and open up an eight-point lead.
O’Loughlin and McIlorum returned, but Wigan didn’t improve. Because of their own mistakes, they just couldn’t get their hands on the ball and - when they did - they finished the set with Leuluai kicking out on the full.
Andre Savelio angled over for a 56th-minute try which Patton converted, and minutes later he levelled the scores with a penalty after McIlorum was penalised for interference at the play-the-ball.
But just as questions began to be asked about whether Tomkins and Bateman could see out the full game, they combined wonderfully to put Wigan back in front.
Tomkins took Leuluai’s pass, arced into the line and Bateman shrugged off two defenders on the way to the line. Williams maintained his perfect strike-rate to make it 26-20.
Wire had their chances, and Wigan were grateful that Ashton Sims twice threw speculative passes which coughed up possession. One of those presented Wigan with a chance to put the game to bed, but McIlorum spilled from the play-the-ball.
Still, they persisted, and with seven minutes to go Tomkins hit a drop-goal which opened up a seven-point buffer.
But just when it looked Wigan could breathe a sigh of relief, Gidley slipped past Powell in the 76th minute to reel in Wigan’s lead to just one point.
And when Burgess kicked it out on the full from the restart, it handed Wire a penalty on the halfway line. Ratchford took on the role and, with one minute to go, swung it wide.
But it gave Wire a final roll of the dice and, in a frantic finish, they defended their line and pressured Patton into miscuing his drop-goal attempt.
And so Wigan survived, and booked their place in the semi-finals of the competition – the draw takes place after tomorrow’s game between Hull FC and Castleford.
Interestingly, in the last eight Cup meetings outside the final between Wigan and Warrington, the victors had gone on to reach Wembley - Wane will be hoping history repeats itself.
Warrington: Ratchford; Dagger, Hughes, Atkins, Lineham; Brown, Gidley; Cooper, Clark, Sims, Jullien, Philbin, Westerman. Subs: Dwyer, King, Savelio, Wilde.
Wigan: S Tomkins; Marshall, Gelling, Gildart, Burgess; Williams, Leuluai; Nuuausala, McIlorum, J Tomkins, Bateman, Farrell, O’Loughlin.
Referee: Ben Thaler
Starman: John Bateman