Wigan got the points they needed to draw level with Super League leaders Leeds Rhinos, but they were given an almighty fright by injury-hit Hull FC.
Teenager Oliver Gildart’s third try in as many appearances helped the Warriors open up an 18-0 lead.
But Hull shrugged off the absence of 12 senior players to claw their way back and in the end the home side were hanging on grimly for their triumph.
Hull, who gave a debut to 19-year-old Zimbabwe-born prop Masimbaashe Matongo, saw their injury woes increase with the loss of winger Tom Lineham and full-back Jamie Shaul, but coach Lee Radford will be supremely proud of the way his young side pushed Wigan all the way.
Early handling errors from George Williams and the returning Joe Burgess showed that all was not well for the Warriors and it needed a last-ditch tackle from full-back Ryan Hampshire to prevent Hull winger Curtis Naughton opening the scoring.
Wigan gradually got their act together, running in three tries – from Gildart, Josh Charnley and Bateman – in a 21-minute spell to open up an 18-0 lead.
Hampshire converted all three tries to make it 18-0 and Hull’s injury problems worsened when leading tryscorer Lineham was forced off after being poked accidently in the eye.
However, the visitors got back into the game with two tries in three minutes before half-time.
Shaul went the full length of the field, before Jack Logan added a second try. Marc Sneyd landed both conversions to cut Wigan’s lead to two points by the interval.
The crowd became even more restless when Powell and Bateman both had ‘tries’ disallowed by the video referees and Hull might have drawn level when Naughton raced into open space but the home defence scrambled to keep him out.
Wigan’s Ben Flower charged over for only his second try of the season. Hampshire added a fourth conversion and extended the lead to 26-12 with a penalty.
But Sneyd’s crossfield kick enabled centre Jordan Rankin to touch down on 69 minutes and two minutes later Logan gathered Danny Houghton’s kick to score his side’s fourth try, with Sneyd kicking his fourth goal to close the gap to just two points.
Burgess went over in the final move to secure victory.
Wigan: Hampshire, Charnley, Gelling, Gildart, Burgess, Williams, Smith, Crosby, McIlorum, Flower, Tomkins, Bateman, Tautai. Substitutes: Powell, Clubb, Mossop, C. Farrell.
Hull: Shaul, Lineham, Rankin, Logan, Naughton, Abdull, Sneyd, Paea, Houghton, Watts, Minichiello, Downs, Hadley. Substitutes: Paleaaesina, Turgut, Fash, Motongo.
Referee: J Child (RFL).