Castleford Tigers 38, Wigan Warriors 28
Wigan let a 20-0 lead slip from their grasp to blow the chance to climb to fifth in the Super League ladder.
Warriors rattled the hosts with an early blitz - including a stunning George Williams try - but Cas' showed their class to punish a leaky defence and turn the game on its head.
Adrian Lam's men found themselves trailing 26-24 midway through the second half and in a nerve-shredding finish in which they briefly retook the lead, they couldn't hold on.
Too often their young middle was out-muscled by a dominant Cas' pack, and Wigan's cause was hampered by the loss of three players - Dom Manfredi, Joe Greenwood and Jarrod Sammut - during the match.
All of Wigan's six tries came down their left edge - hailed by Lam as the best in Super League - including two each for Joe Burgess and Oliver Gildart.
After back-to-back victories, another win would have taken them up to fifth, but they squandered that opportunity as Tigers halted a two-game losing run with a seven-tries-to-six win.
Both sides had their list of absentees, with Castleford heavily down on playmakers - suspended Paul McShane joined injured Luke Gale, Jamie Ellis and Jordan Rankin on the sidelines - while Warriors' pack was again depleted.
Ben Flower and Sean O'Loughlin were late withdrawals, allowing youngsters Ollie Partington, Liam Byrne and Morgan Smithies to retain their places, while Joe Greenwood and Taulima Tautai returned from suspensions.
Zak Hardaker had said he was braced for a hostile reception and he certainly received it, his every touch greeted with boos and every missed conversion cheers.
Wigan finished their last game with a try-scoring blitz and they continued where they left off, racing in four tries in the opening 22 minutes to establish a fabulous 20-0 lead.
Greenwood's strength and dogged determination carried him over the line in the 11th minute.
And the following three tries were all scored down that lethal left edge.
Gildart slipped through the defence for his first try and in the 17th minute, turned creator, carving open Cas' right side to send Williams racing away for a stunning long range try.
Burgess got in on the act in the 22nd minute, finishing off a right-to-left attack and with Hardaker adding two goals, they led 20-0.
Castleford could so easily have wilted but to their credit, they didn't. They frequently chewed up ground down the middle, and got their reward when Oliver Holmes surged over to cut the deficit.
Wigan could have gone further behind had Hardaker not halted first Jesse Sene-Lefao and then Tuoyo Egodo short of the line.
Gildart proved he wasn't all about fancy footwork and flick-passes, muscling his way over from dummy half in the 35th minute to restore Warriors' 20-point lead.
But again the Tigers, erm, roared back, a quick tempo' attack finishing with Calum Turner sweeping over to make it 24-8 at half-time.
Wigan lost Greenwood to a head knock early in the second half but conjured the first attacking opportunity when Tautai, barely recognisable after shaving his locks for a cancer charity, charged through.
That chance collapsed, however, and it came back to bite as Cas engineered three quickfire tries to turn the game on its head in remarkable fashion.
They punished a soft line defence, first when subs Mitch Clark and Matt Cook squeezed over and then through Adam Milner by the 52nd minute.
With makeshift stand-off Peter Mata'utia adding all three conversions, Wigan's comfortable 16-point lead at half-time suddenly became a two-point deficit.
Burgess punished Cas' failure to deal with a high ball to nudge them 28-26 ahead.
Hardaker was again off-target - by his standards, he had an off-night with the boot - and it came back to haunt them when Egodo burrowed over from dummy-half with five minutes remaining to swing the game back in Cas' favour. Mata'utia's conversion put the Tigers 32-28 in front.
And Mata'utia twisted the knife after the siren had sounded to flatter the scoreline of a quite balmy match.
Castleford: Turner; Clare, Egodo, Shenton, Eden; Mata'utia, Trueman; Watts, Milner, Millington, Holmes, Sene-Lefao, Massey. Subs: Cook, Clark, Maher, O'Neill.
Wigan: Hardaker; Manfredi, Sarginson, Gildart, Burgess; Williams, Sammut; Bullock, Leuluai, Navarrete, Isa, Greenwood, Partington. Subs: Byrne, Shorrocks, Smithies, Tautai.
Referee: Chris Kendall
Star man: Oliver Gildart