Gomez converted a penalty after more bad defending by the erratic Martin Demichelis and Perch tapped in early in the second half as the holders booked a semi-final date with Arsenal.
Samir Nasri did pull one back as City produced a strong finish but they were unable to prevent a repeat of Wigan's shock victory 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 City boss 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 his side produced a fightback to snatch the Capital One Cup from Sunderland but they could not repeat the feat and 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 glorious cup run.
They seemed determined to get in City's faces and deny their star-studded opponents any space or time, a plan that worked perfectly.
Wigan created the game's first chance after two minutes but Gomez blasted well over.
City did appear to gain a measure of control in the opening 25 minutes and Scott Carson needed 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, whose list of gaffes is growing, was the culprit again as he was beaten by Marc-Antoine Fortune and then clumsily brought the Wigan forward down.
Gomez, a former youth team-mate of Lionel Messi at Barcelona, rifled home the spot-kick.
City needed 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, appeared in the mood to do so again.
City seemed well aware of this and marked 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 and Richards took out his frustration with 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 realised it was time for drastic action and made a triple substitution, sending on James Milner, Edin Dzeko and Silva after 53 minutes.
The changes turned the tide and City gained the upper hand.
Dzeko headed against the post within minutes of coming on and the atmosphere was cranked up.
City set up camp in the Wigan half and broke through the visitors' rearguard when a low drive from Nasri 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.
It was tough for Wigan to hold out and they got lucky when Sergio Aguero was incorrectly flagged offside before Dzeko had a shot blocked.
Dzeko then looked certain to score as Milner drilled in a low cross but Emmerson Boyce produced a remarkable 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.
Five minutes of injury time were played and City keeper Costel Pantilimon went forward for a last-gasp corner but Wigan held on.
- Sports & Recreation