Salford 22 Wigan Warriors 30
George Williams blazed over for a hat-trick as Wigan snapped a five-game losing streak.
The much-needed victory - their first since beating Leeds in early February - moved them two points clear of the Headingley outfit at the bottom of the ladder.
More importantly, it shook the monkey off their back and lifted some of the gloom which had engulfed the side - against the backdrop of the Shaun Edwards coaching saga circus.
Had Wigan lost this, it would have marked the club's worse start to a season since 1899-1900.
Instead, they edged an entertaining match and showed flashes of the flamboyant attacking style wanted by coach Adrian Lam.
Williams led the way with three tries, but just as welcomed was seeing him reunite with Oliver Gildart and fit-again Joe Burgess on the left-flank.
Wigan scored four of their tries down that side - Joe Greenwood got the other - and it appears it will be their 'go-to edge' for points. Zak Hardaker also caught the eye with another strong outing and a perfect five goals from as many attempts.
At £27 a ticket, it is doubtful there were any neutrals at the AJ Bell - but if there were, they got a free-scoring, seesawing spectacle.
Wigan led 18-6 by the 36th minute but trailed 22-18 by the 41st - it was that kind of game.
As well as welcoming Burgess back after 11 months out, Dom Manfredi and Ben Flower also returned from minor injuries.
Salford had won four from their previous seven matches with Jackson Hastings - a player targeted by the Warriors in the off-season - spearheading their strong start.
It was a nervous start from Wigan, and when Burgess spilled a kick it presented the hosts with the position from which they took a fourth minute lead, Josh Jones grounding Robert Lui's stabbed kick.
Ed Chamberlain missed the conversion but struck a penalty moments later to make it 6-0 by the 10 minute mark.
Wigan did make strides in to Salford's half, and briefly threatened the line only to concede a penalty for obstruction. Errors stalled any progress they were making, and their cause was bruised by the loss of Tony Clubb, who limped down the tunnel for treatment in the 20th minute.
Wigan, though, turned the game on its head with a patch as purple as everyone's favourite Quality Street.
They scorched over for three tries in eight magical minutes to take an 18-6 lead.
George Williams sparked the brief onslaught, showing good skills to take a difficult pass after halfback partner Jarrod Sammut had blazed through the line.
Thomas Leuluai squeezed over from dummy half and, buoyed by the lead, Wigan went hunting more points. Hardaker's direct run down the middle set the platform for another attack, and another try, this time Joe Greenwood charging onto Williams' short pass. Hardaker nailed all three conversions to open up a 12-point gap.
But just when everything appeared to be going well, the sins which had blighted Wigan's season so far resurfaced.
Williams kicked out on the full, and flaky defending was exposed as Salford scored two tries through Derrell Olpherts and Niall Evalds to narrow the margin to two points.
The half-time break did little to interrupt Salford's momentum, Manfredi having the ball ripped from his grasp by Adam Walker, who marked his home debut with a try. Chamberlain's conversion put them 22-18 in front.
Wigan roared back with a sizzling 80m effort which was arguably their best try of the season so far.
Greenwood did well to release a pass around the defender to Burgess, who advanced the ball before feeding Williams on his inside - and he beat the cover to the line. Hardaker's conversion put Wigan in front for the second time.
And just after the hour-mark, Williams secured his treble with another try involving the left-edge link with Burgess and Gildart carving out the opportunity. Hardaker maintained his perfect radar with the boot to make it 30-22.
And they clung on to ensure they secured two much-needed points, ahead of next Sunday's home match against Catalans.
Salford: Evalds; Olpherts, Chamberlain, Bibby, Sio; Lui, Hastings; Murray, Lussick, Dudson, Jones, Turgut, Flanagan. Subs: Griffin, Nakubuwai, Lawton.
Wigan: Hardaker; Manfredi, Sarginson, Gildart, Burgess; Williams, Sammut; Clubb, Leuluai, Navarrete, Isa, Greenwood, O'Loughlin. Subs: Shorrocks, Hamlin, Flower, Bullock.
Referee: Chris Kendall
Starman: George Williams