Substitute Sam Surridge's stoppage-time goal sent Swansea to the top of the Sky Bet Championship thanks to a 2-1 victory at Wigan.
Steve Cooper's men had to do it the tough way, with Paul Cook's Wigan dominating an entertaining encounter at the DW Stadium that they will feel they should have won.
Swansea took the lead after 12 minutes through Nathan Dyer, only for Kieffer Moore to equalise nine minutes later from the penalty spot.
For most of the second period it was Wigan who looked the likelier to win it, with Jamal Lowe hitting the bar and both Moore and Sam Morsy seeing goalbound efforts blocked.
There was to be one more twist in the tale, and it was against the run of play, with Surridge heading home Connor Roberts' cross with seconds remaining.
It was the Swans who started the brighter, with Dyer – the scourge of Wigan during their Premier League years – causing early panic.
The forward almost wriggled into the box only for Cedric Kipre to block his progress.
But Wigan were not so lucky a second time, with Dyer on hand to steer home a clever cutback from Bersant Celina with 12 minutes gone.
Credit Wigan for their response, with Joe Williams sending over two fine set-piece deliveries, the first headed over by Chey Dunkley and the second nodded wide by Moore.
The aerial threat of Dunkley has been Wigan's most potent attacking outlet this term, and Swansea were so scared of the big centre-back they gave away a penalty on the 20-minute mark.
Again it was Williams with the corner, and Dunkley almost had the shirt ripped off his back as he tried to get on the end of it.
Referee Peter Bankes pointed to the spot and Moore lashed home his first goal since his summer arrival from Barnsley.
The Swans were a tad fortunate not to concede a second penalty shortly after, with Moore this time being clearly held in the box, only for the official to wave play on.
At the other end, Celina saw a shot half-blocked by Morsy, with the ball looping over the bar for a corner.
But Wigan continued to dominate as the game entered the second half, and it was inches away from being 2-1 when Lowe raced down the left and cut inside, only to see his blistering strike kiss the bar on its way over.
The home side had another wonderful opportunity with 15 minutes to go, when substitute Joe Gelhardt played Moore clean through.
But the striker took one touch too many to steady himself and Mike Van Der Hoorn got back to block.
It was a similar story with 10 minutes to go when Morsy lashed goalwards only to see the shot deflect just over.
And Wigan were left to rue their failure to finish off the game when Surridge sent the Swans supporters behind the goal into ecstasy.