The defending Super League champions led 6-0 at half-time thanks to a Tom Briscoe try converted by Kallum Watkins, who put his side two scores in front with a 64th-minute penalty.
The drab contest sprung to life in the closing stages, with Wigan full-back Sam Tomkins proving to be the man for the big occasion.
He converted Oliver Gildart’s 72nd-minute try from the touchline to bring his side to within two points and then kicked a penalty and a 35-metre drop goal to secure Wigan’s first win at Headingley for six years.
“It was a very boring, error-ridden game,” McDermott said. “We weren’t great in attack. It was a very greasy ball, I don’t know if that had much to do with it but the quality of the game wasn’t good.
“Defensively both teams showed some steel, we shut down most of what Wigan threw at us for the majority of the game.
“But, after going 8-0 up, we stuck our head up our backside and didn’t pull it out. We played crazy, defended differently and started to back off.
“Wigan were running the ball 70 and 80 yards per set but up until that point we had been containing them to 20 or 30 and making them kick out from touch spots.
“It’s very disappointing we lost it but credit to Wigan, they didn’t go away and the drop goal from Sammy was world class, in those conditions and under that pressure, he nailed it.”
Wigan’s eighth win from their opening 10 matches lifts them to within two points of leaders St Helens to bring a smile to the face of coach Shaun Wane.
“I’m thrilled in the end to get the win but disappointed with the manner of it,” he said. “The conditions were shocking but we made some errors and gave too many penalties away.
“Sam was great last week and he was outstanding tonight and I thought Willie Isa was very good.
“We played tough and showed some good character. You need to be very good for 80 minutes against Leeds. They’re a very good team and tough to beat.