WIGAN went within a whisker of finishing the regular Super League campaign in top-spot - only to be denied by a dramatic twist.
On a rollercoaster ride of a night, Wigan roared from behind with a commanding second-half display to take a metaphorical grip of the league leaders shield - before it was snatched from them in incredible scenes.
Ryan Hall scored a match-winning try in the final play of the game at Huddersfield, ensuring Leeds finished in the No.1 spot, ahead of Wigan on points-difference.
It was a cruel way for the Warriors to learn their fate, particularly after such a dazzling second-half display.
Winger Dom Manfredi bagged his first four-try haul, including three in the second-half and two while Castleford were reduced to 12-men.
But even when the points kept piling on in the final few minutes, the game remained on knife-edge - because of events at Huddersfield.
And as fans checked smartphones for updates, and directors even left their seat to watch the Leeds game through a lounge window at the back of the stand, they had their hopes crushed as news of Hall’s late intervention spread.
It took the shine off the evening, but once the dust had settled Warriors could take comfort from knowing they had a home semi-final to look forward to - against Huddersfield next Thursday.
And crucially, they head into the play-offs in good form after sharpening their attack with this display.
Wigan took a 10-0 lead after a whirlwind start in which Matty Bowen sparkled, but went in at half-time trailing 12-10 - and their dreams of a home semi-final under threat.
But Manfredi’s four tries, some slick team play and some outstanding contributions - from captain Sean O’Loughlin especially - blew the visitors away.
The game was delayed to coincide with the match between Huddersfield and Leeds, and the high stakes appeared to energise the Warriors.
They dominated from the start, pressuring their opponents line and Mafredi powered through three defenders for a third-minute opener.
It got even better as, within minutes, centre Oliver Gildart picked up his own blocked kick, fed O’Loughlin and he put Bowen into space. The full-back proved he still has incredible acceleration to race over for a try he converted.
But Castleford profited from some penalties, and showed signs of the fightback which was to unfold when Junior Moors found space down Wigan’s left.
A scorching break by Bowen, and a looping inside pass to George Williams, deserved a try, but didn’t get one. And that missed-chance cost them as Luke Dorn pierced the home defence - to loud cries of ‘forward’ from the West Stand - and rounded Bowen to get the Yorkshire outfit off the mark.
Then, a high shot by Farrell on Dorn piggybacked the Tigers down field once more, and Moors punished a jagged left-side defence and soft attempt by Bowen, storming over to lock the score - before Gale’s conversion nudged the visitors ahead at half-time.
The tension showed little sign of easing, particularly when Matt Cook stole possession of the ball and went agonisingly close against the run of play.
Wigan survived, composed themselves and soon fell into their familiar rhythm. As a world-class winger, Burgess showed he isn’t a bad centre, either, with an unselfish pass to Manfredi, who threaded through a crowded defence. Bowen’s sideline conversion put Wigan 16-12 ahead.
Manfredi, in chasing a hat-trick, blew a chance to wedge a bigger gap between the sides. And with Bentham penalising the home side repeatedly, the game remained on edge.
But the Tigers were reduced to 12 men when Denny Solomona was sin-binned for holding down Burgess after a break from deep. Even after that, it took a monstrous tackle by O’Loughlin to force a drop-out - and from the repeat set, the heavy-bombardment finish with Manfredi muscling over for his hat-trick try.
And the winger - having scored his third treble of the season - went one better just minutes later to make it 24-12.
With Huddersfield taking the lead against Leeds - their updates were flashed on the scoreboard, to loud applause - it put Wane’s men on top of the ‘live’ ladder, with 10 minutes remaining. Smith added a drop-goal to open up a 13-point lead, before Gildart squeezed over in the left corner for his fourth try in five games.
The result secured - with 11 minutes remaining - attention switched to events across the Pennines. Fans checked their smart-phones for tweets, texts and web updates, discovering Tom Briscoe had put Leeds back into the contest.
Castleford were bruised and broken, and further tries by Williams and Burgess, one converted by Bowen, swelled their lead to 41-12; not enough to overhaul the Rhinos’ for-and-against.
And then came the theatrical finish, the unscripted twist which only sport can provide, to deny Wigan top-spot. Larne Patrick crawled over for a late Wigan try to muted celebrations.
And so the record books will show the Warriors finished the campaign in 2nd. But they won’t show just what a climax the regular campaign had.
Wigan: Bowen; Charnley, Gildart, Burgess, Manfredi; Williams, Smith; Crosby, McIlorum, Flower, J Tomkins, Farrell, O’Loughlin. Subs: Powell, Clubb, Mossop, Patrick.
Castleford: Dorn; Robson, McMeeken, Gibson, Solomona; Roberts, Gale; Lynch, Milner, Millington, Holmes, Moors, Wheeldon. Subs: Cook, Maher, Springer, McShane.
Referee: Phil Bentham
Starman: Sean O’Loughlin