Super League leaders Wigan were stunned by a second defeat in five days as struggling Castleford pulled off a shock victory at the DW Stadium.
First-half tries by Kirk Dixon and Grant Millington earned Cas a 12-0 interval lead.
James Clare's try then extended that lead before Josh Charnley pulled a try back to give injury-hit Wigan hope.
But the third of Dixon's three successful kicks closed the door, taking the visitors three scores clear.
Wigan, beaten at Warrington on Monday night, were without Sam Tomkins, Lee Mossop and Sean O'Loughlin.
But Wigan coach Shaun Wane refused to blame Monday's night's bruising encounter. And he did at least get an encouraging performance from who made his debut from the bench.
But Wane's men are now just a point clear on top, thanks to Huddersfield's home win over Catalan Dragons.
The opening try came in the 20th minute from a Lewis Tierney mistake.
The young full-back did extremely well to collect Rangi Chase's high kick but was clattered with a ferocious hit and dropped the ball, allowing Dixon to touch down.
Wigan attempted to hit back straight away with back-to-back sets and the home crowd thought they had levelled matters with Pat Richards seemingly having a walkover following Sam Powell's kick over, but the Australian winger dropped the ball with nobody in sight.
Having been introduced to the action on 28 minutes, Andy Powell was twice involved in Wigan's next attack when Blake Green thought he had set up their first try but Charnley had been adjudged to have knocked on before Darrell Goulding touched down.
Chase was running the game for the visitors, only a last-gasp Liam Farrell stopping him from extending their lead before Dixon did that with a penalty.
Richard Owen then burst down the right before sending Jordan Tansey clear and he in turn offloaded to Millington to touch down despite the attentions of Tierney for a 12-0 half-time lead.
Chase then took full advantage of another penalty, sending out a sublime ball to Dixon who sent Clare in at the corner to make the score 16-0.
It took Wigan 58 minutes before they managed to cross the whitewash through Charnley in the corner, equalling team-mate Sam Tomkins' mark of 23 tries for the season.
But, with the clock running down, Cas earned another penalty, Dixon kicking the goal to complete a stunning victory.
VIEW FROM THE DRESSING ROOM
Wigan coach Shaun Wane:
"It was a poor performance. I thought Castleford were really good. They defended well and handled the conditions better than us.
"I want to commend them because Daryl Powell has done a great job while he has been there and the best team won. Castleford are the best team we have had here.
"We lacked a bit of energy and, if that is because of last Monday, then I expect us to get over that. We are better than that and it will never be used as an excuse. I still expect us to perform."
Castleford coach Daryl Powell:
"To make the play-offs is a really tough challenge, but you have to believe in achieving something special and I think we do believe that at the moment.
"Being able to perform like we have done has given us a little bit of belief that there is a chance.
"Defensively, to concede four points against any Wigan team is a massive effort so I was delighted with the overall performance. The spirit and toughness of the side is growing all the time. Some of the tries we scored were fantastic."
FRIDAY NIGHT'S LINE-UPS
Wigan: Tierney; Charnley, Goulding, Gelling, Richards; S Powell, Smith; Crosby, McIlorum, Dudson, Hansen, Farrell, Burke.
Replacements: Hughes, Green, Tuson, A Powell.
Castleford: Tansey; Owen, Shenton, Dixon, Clare; Hauraki, Chase; Boyle, Milner, Huby, Holmes, Millington, Massey.
Replacements: Walker, Clark, Thompson, Mason.
Referee: Phil Bentham (Warrington).