Leeds opened the scoring in the 13th minute when Paul Aiton benefited from a defensive lapse to cross the line.
Danny McGuire was penalised in the 17th minute, and Sean O'Loughlin made him pay by crossing the line with Wigan's next attack.
Brad Singleton then scored for Leeds to equalise once again after a good passing move, and Leeds thought they had the lead a few minutes later. This time though, the try was disallowed for an obstruction.
Matty Bowen crossed for his third try of the season before half time as Wigan took an 18-12 lead.
Leeds finally found the leveller with just three minutes remaining when Rob Burrow scored under the posts.
Just as the match looked set to finish as a draw, Smith kicked the ball through the posts to give Wigan the victory.