Gomez converted a penalty after poor defending by the erratic Martin Demichelis and Perch tapped in early in the second half as the holders booked a semi-final tie with Arsenal.
Samir Nasri pulled a goal back as City finished strongly but they were unable to prevent a repeat of Wigan's win in last year's final at Wembley.
The result was a tactical triumph for former City striker Uwe Rosler, who has revived Wigan's fortunes since taking over as manager in December. For his counterpart Manuel Pellegrini, the decision to leave the likes of Vincent Kompany, David Silva and Fernandinho out of his starting line-up - with Wednesday's Champions League trip to Barcelona in mind - backfired.
A week ago Manchester City fought back against Sunderland to win the Capital One Cup but their hopes of a domestic treble are over.
Wigan may not play the same passing game that they did under Roberto Martinez but, in terms of effort and commitment, their display evoked memories of last year's cup run.
They seemed determined to press City and deny them any space or time, a plan that worked perfectly.
Wigan created the game's first chance after two minutes but Gomez shot well over, and City went on to largely control the opening 25 minutes. Visiting goalkeeper Scott Carson had to react quickly as Ivan Ramis almost turned a Jesus Navas cut-back into his own net.
But with Demichelis in the back line, City do appear error prone. The former Malaga defender was beaten by Marc-Antoine Fortune and then clumsily brought down the Wigan forward. Gomez, a former youth team-mate of Lionel Messi at Barcelona, rifled home the spot kick.
City tried to respond and there were promising signs as Nasri wriggled his way into the area only for his cross to drift over the bar.
Wigan refused to be intimidated and Callum McManaman, who ran City ragged at Wembley, seemed in the mood to do so again, with City marking him out for special attention. He was brought down crudely by Javi Garcia on the right and then Micah Richards attempted to haul him down on the opposite side.
Play continued on the latter occasion before Richards made a mistimed challenge on Gomez.
Several players from both sides then became involved in a melee and McManaman gestured that he had been elbowed. Pictures appeared to back up his claims.
Wigan applied more pressure and it paid off inside the opening two minutes of the second half as James McArthur took advantage of more poor defending to break through on the left.
He pulled the ball back across goal and Perch nipped in ahead of Gael Clichy to tap in at the far post.
Wigan threatened another within moments of the restart as Fortune clipped the post but the flag had already been raised for offside.
Pellegrini reacted with a triple substitution, sending on James Milner, Edin Dzeko and Silva after 53 minutes, and the changes led to City gaining the upper hand.
Dzeko's header against a post within minutes of coming on induced an audible increase in the home crowd's intensity and their side set up camp in the Wigan half, breaking through the visitors' rearguard when a low drive from Nasri from just outside the area crept beyond the diving Carson.
Even then there was an element of controversy with Joleon Lescott, standing in an offside position, having flicked out a boot at the ball as it made its way through.
Wigan got lucky when Sergio Aguero was incorrectly flagged offside before Dzeko had a shot blocked, before looking certain to score as Milner drilled in a low cross but Emmerson Boyce produced a last-ditch clearance.
Carson saved well from Aguero, Milner had a shot blocked and Dzeko headed wide as City laid siege to the Wigan goal. With five minutes of time added on City keeper Costel Pantilimon went forward for a last-gasp corner but Wigan held on.