The forward bagged his sixth goal of the season with just three minutes left as the game looked to be heading towards a stalemate.
Gomis had been denied twice by Brad Guzan and Wayne Routledge had a shot cleared off the line as the Swans made most of the running at Villa Park.
Gabby Agbonlahor was denied by Neil Taylor in the first half but Villa struggled to create and remain three points clear of the Barclays Premier League bottom three with Swansea eighth.
Alan Hutton replaced Matt Lowton in Villa's only change while Federico Fernandez came in for Jordi Amat for the visitors.
And the Swans threatened first when Gylfi Sigurdsson tricked his way into the box, found the overlapping Taylor but Gomis could not beat Brad Guzan from the cut back.
It set a pattern for the first half as the Swans tried to pick their way through the Villa defence with little end produce.
Gomis was Swansea's biggest threat early on and Ki slipped the striker in but Guzan was equal to his angled drive.
Fernandez then produced a fine tackle to stop Christian Benteke breaking free in the area but Villa offered little in the opening half an hour.
It was reflected in the terraces with Villa Park flat, waiting for something to happen after the swashbuckling way their side dispatched Sunderland last week.
It took until the 32nd minute for Villa to test Lukas Fabianski, when Fabian Delph shot straight at him following Scott Sinclair's run.
But Villa were second best and survived a scare four minutes later when Guzan spilled Sigurdsson's free kick to Routledge and his follow up was hacked off the line by Ciaran Clark.
While Swansea were slick they failed to find a first-half breakthrough and the trend continued immediately after the re-start.
Guzan tipped over Sigurdsson's 30-yard free kick before Gomis nodded over at the far post and the hosts almost cashed in on those misses on 56 minutes.
Benteke headed down Hutton's cross for Agbonlahor but, in front of goal, the striker could not get the ball out of his feet quick enough and Taylor managed to block his six-yard effort.
Villa had wrestled themselves a foothold in the game and Sinclair was inches away from connecting with Agbonlahor's driven cross before dragging wide with 20 minutes left.
Jefferson Montero, on for Sigurdsson, had given Swansea a different dimension though and his barnstorming run on 74 minutes left Bacuna for dead, only for Clark to block Gomis' shot.
Delph fired over with six minutes remaining as the game meandered to a close before Gomis won it in the 87th minute.
Montero had made a difference for the visitors and his excellent low centre found Gomis who fired in from six yards.
Sinclair then almost grabbed an equaliser against his former club a minute later but volleyed over from 10 yards.
And Routledge could have finished it in injury time when he raced clean through but Guzan saved.
Source : PA
Source: PA