Relegated Rotherham United suffered their 10th successive Championship defeat as Paul Warne's first match as permanent manager ended in last-gasp agony.
The Millers looked set for only their second away point of the season, with the scores locked at 2-2 deep into time added on.
But the referee stopped play after a bizarre altercation between visiting goalkeeper Lewis Price and Wigan substitute Nick Powell before awarding a free-kick that Powell smashed home.
Price had kicked the ball downfield but then appeared to jump on Powell's back during an argument with the Latics man.
Warne, who was named full-time boss on Wednesday after 23 games in caretaker charge, watched his side lead twice only to be pegged back on both occasions within five minutes.
The Millers are at the foot of the table and already down. This was an encounter of very little quality, and the second-bottom Latics will surely be joining Warne's men in League One next year despite today's victory.
The visitors went in front after 29 minutes when Danny Ward side-footed home from Joe Newell's supply.
However, their lead lasted only five minutes as Gabriel Obertan was given far too much time and space in the Millers penalty area to fire past Price.
It was Ward's first league goal since Boxing Day, and he should have been on the scoresheet as early as the sixth minute. He did well to block keeper Jakob Haugaard's clearance only to scuff his shot wide of an empty net as he lost his balance.
The Millers were ahead again in the 60th minute when Anthony Forde's 20-yarder found a way through Haugaard but, once more, they couldn't hold on to their advantage as Alex Gilbey rounded off a Wigan breakway just five minutes later.
Ward missed his second sitter of the game in the 72nd minute, shooting straught at Haugaard when it looked easier to score, while Price produced excellent second-half saves to deny Gilbey and Powell.
The Millers were left to rue Ward's spurned chances and Price's moment of madness as Powell struck with just seconds left.
Wigan Athletic (4-3-3): Haugaard, Hanson, Burn, Morgan, Warnock; Gilbey (Powell 74), MacDonald, Power (Morsy 52); Jacobs, Obertan (Byrne 85), Colclough. Subs not used: Gilks, Buxton, Connolly, Mandron.
Rotherham United (4-4-2): Price; Fisher, Ajayi, Wood (Belaid 71), Mattock; Forde (Clarke-Harris 85), Smallwood, Vaulks, Newell (Taylor 79); Morris, Ward. Subs not used: O'Donnell, Purrington, Bray, Yates.
Goals: Obertan 34, Gilbey 65, Powell 90+7 (Wigan); Ward 29, Forde 60 (Rotherham).
Referee: Scott Duncan (Northumberland).
Attendance: 10,085 (412).