Sam Powell struck a stunning late drop-goal from more than 40 metres out to snatch a dramatic win for Wigan at Hull KR on Sunday afternoon.
The Robins were 18-14 ahead leading into the final few minutes when Liam Marshall squeezed over to lock the scores.
With Wigan's attack faltering, it appeared the game may be the third of the weekend to head into Golden Point.
But with two minutes to go, Powell stepped up with a wonderful drop-goal to poke the Warriors ahead - and snap a three game losing run.
Wigan, who outscored their opponents four tries to three, climbed a spot to eighth and remained four points off a play-offs spot.
While they looked composed in the first-half - which they led 14-6 - they faded dramatically, allowing KR to take control and roar back into the contest.
Powell was the hero of the hour but in another mixed team display, there were notable contributions from Dan Sarginson and Tony Clubb while Liam Farrell went well on his return from a four month injury lay-off.
KR paraded new coach Tony Smith before kick-off and the former Warrington boss endeared himself quickly to the fans, citing their passion as a big incentive in taking the role from sacked Tim Sheens.
His preparations for his first game were hampered by the loss of Danny McGuire to a calf injury.
Wigan were at their strongest this year. Wingers Dom Manfredi and Tom Davies - both out for the year - and forward Joe Greenwood (ribs) were the only players ruled out. Jarrod Sammut, Chris Hankinson, Romain Navarette and Morgan Escare were among those overlooked.
Incredibly, this was the first meeting between these sides all season - by contrast Wigan have already faced Warrington three times.
There was little between them for 35 minutes but two rapid-fire tries helped Lam's side into a 14-6 lead at the break.
It wasn't the most exciting opening half but the Warriors kept errors to a minimum, while their tigerish defence limited KR's genuine attacking chances.
Marshall threatened early on before Wigan took the lead down the opposite edge. Farrell, reinstated to the left-edge, linked-up well with Oliver Gildart and Joe Burgess before the winger sent George Williams over - albeit from a pass which appeared forward.
Zak Hardaker tagged on the extras to give them a 6-0 lead by the 11th minute By then, they had lost Welsh prop Ben Flower to injury.
Wigan's defence received a stern test, with three successive sets on their line. And though they survived, and then countered well through Sarginson's weaving run, the Robins drew level when Jimmy Keinhorst picked off Farrell's pass and broke from deep. Ryan Shaw's conversion locked the scores.
Wigan frequently made swift progress down the field and were well organised in that area, but they wasted three chances in KR's 20m area - before they finally clicked.
Sarginson punished a stretched defence in the 35th minute and then when Chris Atkin kicked the restart out on the full, it provided the visitors the chance to extend their lead.
They swung the ball to the left where Gildart jetted at a splintered defence, before sending Burgess over in the corner.
Williams took over the goal-kicking duties and was twice off-target. Hardaker was taken off at half-time, forcing Lam into a reshuffle which saw Willie Isa move to right centre and Sarginson switch to full-back.
At 14-6, Wigan looked in control but they fell away from what they had been doing well and Will Dagger and Ryan Lannon crossed the tries against a tiring defence.
Powell struck a 40-20 but Wigan couldn't find their rhythm, with too many passes either off the mark or forward.
The game was held up for eight minutes to allow centre Kane Linnett to receive treatment after he was injured when he raced up to tackle Sarginson. The Scotland international was stretchered off and, when play resumed, a Taulima Tautai knock-on saw another chance crumble.
Shorrocks was brought off the bench and moments later, frequent probing down the right eventually saw Marshall dive over in the corner from Isa's pass.
Williams was again off-target with another difficult conversion and so with 13 minutes to go, it set up a thrilling finish.
Wigan blew a chance to extend their lead and then were grateful to Leuluai for a try-saving desperate tackle on Drinkwater - and a penalty from a high-tackle on Sarginson piggybacked the visitors down field.
And with two minutes to go, Powell struck a stunning one-pointer to put then in front. With seconds to go, Drinkwater pulled a 40-metre attempt wide - and Wigan breathed a huge sigh of relief.
Hull KR: Hall; Crooks, Keinhorst, Linnett, Shaw; Drinkwater, Dagger; Harrison, Addy, Masoe, Tomkins, Hauraki, Lawler. Subs: Atkin, Maria, Lannon, Mulhern.
Wigan: Hardaker; Marshall, Sarginson, Gildart, Burgess; Williams, Leuluai; Flower, Powell, Clubb, Isa, Farrell, O'Loughlin. Subs: Bullock, Shorrocks, Smithies, Tautai.
Referee: Scott Mikalauskas
Warriors starman: Dan Sarginson