League Two Swindon dumped Wigan out of the FA Cup to reach the fourth round for the first time since 1996.
Swindon fell behind after Callum McManaman won a penalty for Wigan and was on hand to put the ball away when Ben Watson's spot-kick hit the post.
But Paolo Di Canio's side quickly drew level thanks to Alan Connell's header.
Swindon secured a remarkable win when Matt Ritchie's left-footed shot took a big deflection off substitute Paul Benson to beat Ali Al Habsi.
In an emotional interview with BBC Wiltshire on the touchline immediately after the final whistle, Di Canio dedicated the win to Swindon's fans and to his father, who died late last year, as supporters chanted the manager's name.
Swindon, who are in the League Two play-off places, were well worth their win against a Wigan side that showed nine changes to the team that lost to Sunderland in midweek.
Di Canio's men should have taken the lead as Raffaele De Vita seized on Adrian Lopez's misplaced pass and picked out Ronan Murray, only for the on-loan Ipswich striker to shoot straight at Al Habsi.
Paul Caddis's deflected cross then skidded past the Wigan goalkeeper's post, while Swindon full-back Callum Kennedy tried his luck from long distance.
Despite that promising start, Swindon went behind on 34 minutes after Aden Flint fouled McManaman in the area.
Watson's spot-kick rebounded off the post, but McManaman reacted quickest and slipped the ball beneath Swindon keeper Wes Foderingham.
SWINDON'S DUAL PATH TO WEMBLEY
Swindon travel to Barnet on Tuesday for the first leg of their Johnstone's Paint Trophy area final
Undeterred, Swindon were soon back on the attack and only Al Habsi's outstretched hand denied winger Ritchie.
It was a cross from Ritchie that created Swindon's equaliser on 40 minutes, with Connell glancing a header past the Latics keeper.
Di Canio brought on Benson for the start of the second half and the signing from Charlton began to link up well with Connell, who poked Kennedy's cross wide of the near post after 50 minutes.
Connell claimed a penalty when he went down under pressure from Gary Caldwell, but referee Peter Walton was not convinced.
On the hour, Ritchie flashed an effort high and wide when well placed after a neat passing move.
However, the left-winger soon made amends when he collected Simon Ferry's pass 25 yards out and let fly with a low drive that struck the legs of Benson and rolled into the net with Al Habsi stranded.
In an attempt to conjure up an equaliser, Wigan boss Roberto Martinez brought on Victor Moses as the visitors switched to a four-pronged attack.
But the Premier League strugglers were unable to find a way through as Swindon's defence held firm to secure another memorable FA Cup moment for Di Canio, who scored in West Ham's win over Manchester United at Old Trafford 11 years ago.
Swindon manager Paolo di Canio told BBC Wiltshire:
"My lads today deserve to have their names put on this stadium.
"I know you normally do this when you win something important and I don't want a big statue but maybe a plaque.
"Today we did something special."
Wigan manager Roberto Martinez told BBC Radio Manchester:
"It is important to see how the youngsters are developing. I felt we did many good things.
"The winning goal was clearly offside. It is a day for Swindon Town, we congratulate them.
"My only regret is I should have made 11 changes [from their last game]."
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.