Jay Emmanuel-Thomas netted in the 84th minute to earn Gillingham all three points at Walsall on Saturday.
But the goal was incredibly harsh on the Saddlers who had gone on to dominate the game once Jason McCarthy had equalised following Cody McDonald’s early opener.
Jon Whitney’s side saw three efforts cleared off the line and a host of half chances all go by the wayside in an overall impressive display.
But Gillingham managed to hang in under pressure and snatch a late winner to earn under-pressure boss Justin Edinburgh a crucial victory.
The Gills – who suffered a shock FA Cup defeat to National League North outfit Brackley on Wednesday - Emmanuel-Thomas and Bradley Dack started in a 4-3-3 system.
They arrived with boss Edinburgh under mounting pressure due to his side having failed to keep a clean sheet in their last 23 League One outings.
But within 90 seconds they had got themselves in front with the Saddlers failing to deal with Dack’s cross and McDonald looping a header up and over Neil Etheridge from close range.
Walsall response was immediate with Whitney’s side pulling level just six minutes later.
A wonderful scooped ball from Joe Edwards found McCarthy in the box with the defender bustling his way past Baily Cargill before emphatically firing past Stuart Nelson from a tight angle.
Lifted by the goal, the Saddlers began to pass the ball at pace and tempo with the lively Edwards popping up all over the park to ensure they quickly retrieved possession whenever play broke down.
That pressure lead to half chances for Simeon Jackson and Kevin Toner who both saw headers deflected wide. Erhun Oztumer’s rasping drive was then put behind by Max Ehmer.
But as the half-time whistle approach, Whitney ‘s men twice came close to taking the lead.
First, Ehmer managed to head away Josh Ginnelly’s cross from virtually under his own crossbar with the touch preventing a loitering Simeon Jackson from having a tap-in.
Then just seconds later, Franck Moussa burst into the box with his deflected effort sailing over Nelson before being spectacularly cleared off the line by Cargill.
The Saddlers continued on the front foot at the start of the second half with Edwards and Oztumer both going close from distance.
But while they remained the more inventive of the two teams, the game had become something of a stalemate as the half reached its midway point.
That was until the 70th minute when Scott Laird rose highest from a corner but his powerful header was hacked off the line by a Gills defender.
Suddenly it was all Walsall, with the hosts enjoying an extended spell of possession in and around the Gills box and also whipping in lots of inviting crosses.
But they were unable to make their dominance count and were made to pay when Jackson gave away a free-kick inside the ‘D’.
Emmanuel-Thomas stood over the set-play and drilled a strike which took a heavy deflection before sailing past Etheridge.
The Saddlers desperately went in search of a late equaliser, but they were unable to break through the Gills defence with the visitors holding on to take all three points.
The win takes The Gills up to 15th place in League One and will undoubtedly take some pressure off the under fire Edinburgh.
With a trip to Oxford United to come on Tuesday night and sitting just four points outside the play-off places, The Gills will know a win will go a long way to changing their fortunes.
Walsall: Etheridge, McCarthy, Preston, Toner, Laird, Edwards (Bakayoko 87), Chambers, Ginnelly, Oztumer, Moussa (Cuvelier 86), Jackson.
Subs not used: MacGillivray, O’Connor, Dobson, Kinsella, Makris.
Goal: McCarthy (9).
Gillingham: Nelson, Wagstaff, Konchesky, Cargill, Ehmer, Wright, Hessenthaler, Knott (Byrne 73), Dack (Osadebe 73), Emmanuel-Thomas, McDonald.
Subs not used: Hadler, Oshilaja, Donnelly, Oldaker, Cundle.
Goals: McDonald (2), Emmanuel-Thomas (84).
Booked: Ehmer (72).
Referee: Mr John Busby
Attendance: 5,420