Victory over Manchester City on Monday had put Chelsea right back in the Premier League title race but they huffed and puffed here and had created little before Daniel Sturridge tucked away Ashley Cole's pass in the 59th minute.
That looked to be that but two minutes from time Petr Cech fumbled a weak effort from Hugo Rodallega and Gomez guided the ball into an empty net for his fourth goal in five games.
Frank Lampard returned to the Chelsea starting line-up for the first time in three games in place of Ramires, was missed out with a bruised leg, while Wigan boss Roberto Martinez kept faith with the side that beat West Brom last weekend.
Last season Chelsea put six past their hosts at the DW Stadium but the Latics have shown encouraging form in recent weeks and they had the better of the game in the early stages.
Victor Moses again stood out with his pace and trickery, and he played a part in a move that ended with Gomez tumbling in the penalty area, although contact from Cole seemed minimal and referee Martin Atkinson waved away the muted penalty claims.
At the other end, Gary Caldwell did well to block a dangerous cross from Sturridge while John Terry had Ali Al Habsi diving with a well-struck shot from 30 yards that flew a yard past the post.
Chelsea had settled and were pushing for the breakthrough, which they nearly achieved in the 23rd minute when a cross was only cleared as far as Oriol Romeu, who let fly with a volley that was pushed round the post by Al Habsi.
Didier Drogba was a fraction away from the opener seven minutes before the break when he got his head to a lovely Raul Meireles cross but, under pressure from Ronnie Stam, he could not keep his effort on target.
Wigan then felt they should have had a penalty when Branislav Ivanovic pulled his left arm across his body and into a shot from Moses, but again Atkinson was unmoved.
The Latics ended the half on the offensive as Moses just failed to get a toe to David Jones' dangerous low cross.
Salomon Kalou came on for Romeu at the start of the second half and took up position on the left, allowing Juan Mata to move into a central role behind Drogba.
Gomez tried his luck with a volley that was always just the wrong side of the post, while Kalou made his presence felt straight away with a jinking run and shot that was blocked by Stam.
The game was a bit more open now and Kalou set up Drogba for a shot into the side netting before the deadlock was broken in the 57th minute with a simple goal superbly executed by Chelsea.
Cole was allowed to run into the Wigan half and pick out Sturridge with a pinpoint diagonal ball.
The striker took the ball down with one touch on the right of the area before lashing it past Al Habsi for his ninth goal of the season.
Wigan now had to commit more men forward and Figueroa's low shot from the edge of the box was heading into the far corner before Cech got a hand to it.
Martinez made a double substitution with 19 minutes remaining, sending on strikers Rodallega and Franco Di Santo for Jones and Conor Sammon.
There was a worrying moment for Chelsea when Terry landed awkwardly after a challenge on Di Santo but the skipper was able to continue after treatment.
Some poor defending from Ivanovic then presented Wigan with a golden chance as his weak backpass let in Rodallega.
Cech was out sharply to block but the keeper was stranded as Di Santo shot only for Ivanovic to make amends with a header off the line.
Time was ticking away but Wigan did not give up and they got their reward in the 88th minute when Cech failed to hold a poke towards goal from Rodallega and Gomez turned the ball into an empty net.