City were reduced to 10 men at the end of the first half, and Wigan took advantage when Will Grigg fired a late winner to spark dramatic scenes.
Fabian Delph was shown a straight red card on the stroke of half-time, and the incident gave the home team the energy and advantage they needed to progress.
Wigan will host Southampton in the last eight.
Here is the updated FA Cup quarter-final draw:
Manchester United vs. Brighton & Hove Albion
Wigan vs. Southampton
It developed into a stressful night for City as they made the short hop to Wigan in Greater Manchester, and the Premier League side struggled to break the deadlock in an open match.
David Silva returned to the starting XI as City manager Pep Guardiola fielded a strong side, but Kevin De Bruyne was rested on the bench.
As expected, City dominated the ball, but Wigan did a great job of closing down their illustrious opponents in the opening stages.
Sergio Aguero went closest for the visitors, but his shot was saved by Latics goalkeeper Christian Walton.
Grigg remained a nuisance for the hosts in attack, with City defenders caught on the ball in a couple of instances.
The flashpoint of the first 45 minutes occurred seconds before the half-time whistle. Delph was penalised for a challenge on Max Power, and the Wigan player writhed in pain as the City midfielder protested his innocence.
Referee Anthony Taylor initially pulled the yellow card from his pocket but then upgraded the punishment to red.
The moment was hotly disputed by City's players and coaching staff, but television replays showed Delph was out of control as he made the tackle.
Mark Ogden of ESPN backed the referee's call:
Guardiola was clearly upset, and he was forced to make tactical changes early in the second half.
Kyle Walker replaced Leroy Sane, and City reshaped their attack and continued to play progressive football.
De Bruyne was drafted into the action as the visitors attempted to negate their numerical disadvantage, but Wigan continued to fight while City piled on the pressure.
The last 20 minutes were hectic, and De Bruyne's arrival put wind in City's sails.
However, events took a shocking turn as Wigan raced away on the break in the 79th minute. Walker let the ball run past him, but Grigg raced onto it and held off the England full-back before firing into the bottom corner.
City threw everything at Wigan in the closing stages, and hearts were in mouths as De Bruyne dictated the traffic.
However, Wigan survived and and earned a thoroughly deserved win against one of the best teams in world football.