Preston were cruelly knocked out of the Carling Cup as Wigan's Charles N'Zogbia grabbed an injury-time winner in a pulsating third-round tie.
Keith Treacy gave the visitors the lead by squeezing a well-struck 25-yard, low free-kick in at the near post.
Preston's Paul Coutts twice hit the woodwork before Wigan's Jordi Gomez levelled with just three minutes to go.
With the game heading for extra-time Wigan broke from deep and James McCarthy set up N'Zogbia to score.
The France midfielder - who was Wigan's player of the season in 2009/10 but has been a more marginal figure this campaign amidst rumours he wished to leave the club - was key to the victory having come on as a substitute at the start of the second half.
He added drive to what had been a largely drab first-half display from the Latics and provided the game's decisive moment when he exchanged passes with McCarthy and blasted past Preston keeper Andy Lonergan two minutes into injury time.
Four minutes earlier, Gomez had drawn the home side level with a superb solo effort after having jinked into the box.
However, prior to this final salvo it appeared as though Wigan were destined for elimination at the hands of their Lancashire rivals, who held the lead for just over an hour of the match thanks to Treacy's 22nd minute free-kick.
North End could have been out of sight had Coutts found the goal with a brace of efforts - one in each half - but he struck the woodwork with each.
Despite the defeat, Preston can take hope from a performance that belies their lowly position in the Championship, whilst Wigan will hope the win can be a springboard for the rest of their season.
Wigan manager Roberto Martinez: "It is quite clear the talent Charles has got. The way he has acted since the window has closed has been an example for everyone.
"He has talent and many would pay money to watch him play football.
"More importantly he worked for the team extremely hard and, with his build-up towards the game, his day today has been sensational.
"In the second half I was very proud of a group of players that care about gelling together."
Preston manager Darren Ferguson: "Obviously they had one or two opportunities but they were two awful goals for us to lose.
"I couldn't really see a way of them getting through and they huffed and puffed. Both goals were stoppable. Individual mistakes cost us the game.
"I'm not looking for excuses but we just aren't getting any luck - Coutts hit the bar, post - it's game over if that went in."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.