England winger Josh Charnley broke Huddersfield hearts with a try four minutes from time as Wigan snatched a sixth successive win over the injury-hit Giants.
Huddersfield were without eight members of their 25-man squad through injury, including the newly-retired Luke Robinson, but their makeshift side produced a performance brimming with enthusiasm that deserved a better reward than a glorious 18-13 defeat.
Out on their feet at the end, the Giants thought they had secured a famous backs-to-the-wall victory when a drop goal from man of the match Jamie Ellis edged them 13-12 in front with 10 minutes to go.
But Wigan, who themselves were understrength without Sam and Joel Tomkins, stand-off George Williams and front rower Dom Crosby, finished the stronger side and skipper Sean O'Loughlin delivered the killer blow by sending Charnley over for the all-important score.
It was tough on Ellis and acting captain Ryan Hinchcliffe, who did a superb job between them of making up for the absence of the talismanic Danny Brough. Ellis carved out the first scoring opportunity midway through the first half when he exposed a chink in the visitors' defence but ruined it by sending out a forward pass to hooker Kruise Leeming.
But the former Castleford man was spot on four minutes later when his pinpoint cut-out pass got England winger Jermaine McGillvary over at the corner for the game's first try and he made it 6-0 with the difficult conversion.
Ignoring Huddersfield's inexperienced debutants Jamie Foster and 18-year-old Sam Wood out on the left flank, Wigan appeared intent on attacking their experienced right, where England duo Leroy Cudjoe and McGillvary comfortably dealt with everything thrown at them.
The Warriors' best chance of the first half fell to centre Anthony Gelling, who lost his grip on the ball as he attempted to touch down under pressure from full-back Aaron Murphy, but they drew level in the first meaningful attack of the second half. Centre Dan Sarginson got his hand to Matty Smith's high kick, palming it back for second rower Liam Farrell to touch down.
Smith's conversion made it 6-6 but Huddersfield thought they had regained the lead on 56 minutes when stand-off Jake Connor got a touch to Leeming's grubber kick, only for video official Ben Thaler to agree with referee Phil Bentham that he did not have control of the ball.
A minute later Wigan regained possession from Smith's towering kick and Gelling's looping pass found winger Dominic Manfredi with space to cross at the corner. With Smith converting from the touchline, it looked to be a huge turning point in the game but Huddersfield had other ideas.
Foster, the former St Helens winger who is on trial at the Giants, gathered Connor's pass to cross for a try and, although Ellis badly hooked the conversion attempt, he brought his side level four minutes later with a penalty.
Ellis then had a drop-goal attempt charged down but succeeded with a second attempt 10 minutes from the end that looked to be the decisive score until Charnley's late effort.