Wigan (6) 12
Tries: Ainscough 2Goals: Roberts 2
St Helens (6) 19
Tries: Cunningham, Gidley, PryceGoals: Wellens, Eastmond 2 Drop goals: Eastmond
Gidley continued his fine recent form with another try
Two tries in the space of three minutes either side of the hour mark helped earn St Helens a hard-fought win over Wigan at the JJB Stadium.
The Warriors threw everything at their local rivals and led 12-6 after 53 minutes thanks to two tries from Shaun Ainscough and two Amos Roberts goals.
But Matt Gidley and Leon Pryce crossed in quick succession, with Kyle Eastmond converting twice to make it 18-12.
Eastmond's late drop goal from long distance sealed another win for Saints.
It was Wigan's best performance of the season and they pressurised the Saints defence from the start, forcing the visitors to commit some uncharacteristic errors.
On eight minutes, the pressure paid off when Ainscough touched down Thomas Leuluai's grubber kick, although Roberts missed the extras.
The home side's lead lasted barely a minute when an error straight from the restart handed possession back to Saints.
Kieron Cunningham eventually burrowed over from close range for his 170th career try, with Paul Wellens kicking the conversion to give Saints the lead.
Wigan thought they had regained the lead when Gareth Hock took Sean O'Loughlin's pass and twisted out of Gidley's tackle to touch down, but the try was disallowed by the video referee for a double movement.
Despite having the better of the possession, Wigan lacked a cutting edge and could only manage a Roberts penalty before the break after Iafeta Paleaaesina was felled by three Saints defenders.
Wigan missed a great chance to score through Roberts after the interval, but they were finally rewarded on 52 minutes when Phelps and Leuluai combined for Ainscough to go over in the corner for his second try of the game.
Saints hit back when some neat play by James Roby and Leon Pryce allowed Gidley to go in for his fourth try in his last three matches.
Moments later, Jon Wilkin's high kick caused all sorts of problems in the Cherry and Whites defence, Pryce rising highest to score.
Eastmond added the extras before landing his 40m drop goal.
Wigan coach Brian Noble:
"The players are very disappointed. They feel they've done enough, but it's a salutary lesson in that a champion team keeps fighting.
"Had we executed our opportunities, certainly in the first half, and maybe got the call from the video ref, it may have been different but you have to give full credit to St Helens.
"There are really good positives for us. I think we can create some momentum from this. I thought we competed really well."
St Helens coach Mick Potter:
"It was a close match and I enjoyed the fans chanting. I'm just glad we finished on the right end of the scoreboard.
"The defence was probably the most pleasing aspect. The guys showed some real resilience and belief in holding the other team out.
"We made the game very tough. There was an easy way to do it but we couldn't find it. We had to do it the hard way but they showed the mental toughness to find the energy to do whatever it took."
Wigan: Phelps, Roberts, Gleeson, Carmont, Ainscough, S. Tomkins, Leuluai, Fielden, Riddell, Coley, Hock, Bailey, O'Loughlin.
Replacements: Paleaaesina, Hansen, McIlorum, Prescott.
St Helens: Wellens, Gardner, Gidley, Gilmour, Meli, Wilkin, Pryce, Graham, Cunningham, Hargreaves, Puletua, Ashurst, Clough.
Replacements: Fa'asavalu, Roby, Frodsham, Eastmond.
Referee: B Thaler (Wakefield).