Olivier Azam spearheaded a huge effort from Gloucester's pack under extreme pressure in the final 20 minutes
A determined defensive display by Gloucester all but guarantees them a Premiership play-off place following their 27-15 win over Northampton.
Saints went ahead through Alex Waller before Gloucester hit back with a Freddie Burns penalty and converted Tim Molenaar and Charlie Sharples tries.
Another Burns penalty and an Olivier Azam try made it 20-8 after the break.
Lee Dickson poached his converted try for Saints but Soane Tonga'uiha's late effort for a bonus point was ruled out.
Gloucester need just two more points from two games to secure a play-off berth and retain an outside chance of playing at home in the semi-finals.
The home side's forwards initially had the upper hand on the more inexperienced Saints pack but were lucky to still have eight on the field after the officials missed a blatant head butt by hooker Azam on Northampton lock Adam Eustace in the opening minutes.
Saints scored with their first foray into Gloucester's 22 when Geraghty's perfectly-timed pass saw Waller hold off Nicky Robinson to go over, but the Saints fly-half struck the post with the conversion.
The hosts came back almost immediately when Molenaar hit Robinson's pass at pace and cut a swathe through Saints' midfield to race under the posts unchallenged.
Burns added the conversion to make it 7-5 with a quarter-of-an-hour gone.
The full-back added three more points from a collapsed scrum after Geraghty had knocked on a simple pass seven metres out.
As the first quarter passed the Saints pack began to find their feet in a succession of scrums and mauls that took them to within five metres from where Geraghty landed a penalty to bring his side to within two points.
But Gloucester pushed ahead again when Burns sent through a grubber which Sharples raced onto, leaving Bruce Reihana for dead, before touching down.
Burns rounded off his good work with a conversion.
Robinson, in his first game back for a month after a hamstring injury, left the field after a laboured 35 minutes and despite good chances at either end and a missed penalty from Gloucester the teams turned around at 17-8.
The second half started in a frenzy as both sides lost their own ball and were turned over in rapid succession.
Alex Brown was denied by a last-gasp tackle from Greig Tonks and shortly after Burns was caught in two minds, yards short of the line with a huge overlap outside.
The Cherry and Whites stand-off made it 20-8 with a penalty but - somewhat inevitably - Azam, who was lucky to be on the field, scored when he broke from the back of a driving maul and touched down on the line. Burns was again on target with his boot.
Saints responded by bringing on their entire first-choice front row off the bench for an attacking five-metre scrum but after a series of re-sets it was the Cherry and Whites that won a penalty, to the delight of their fans, and cleared their lines.
Northampton pushed for a second score but Gloucester's defensive resolve was heroic and denied Dylan Hartley when he fumbled his reach for the line.
Dickson poached a try with seven minutes left when the ball squirted out the side of a five metre scrum, as Geraghty converted.
Saints came again but it was more superb defending that kept the visitors at bay and won them a penalty to snuff out the danger once more.
Tonga'uiha looked like he had won a crucial losing bonus point for Saints with two minutes left but the video replay showed he lost control of the ball at the vital moment.
The result extends Gloucester's impressive unbeaten home record and puts them nine points clear of fifth-placed London Irish.
Northampton move onto another crucial fixture next weekend when they travel to the Exiles.
Gloucester head coach Bryan Redpath: "Northampton are a dangerous team, and if you looked at the strength of their bench tonight, then a 15-point lead could easily have been clawed back.
"But I am delighted for our players. They dug in and defended exceptionally well. We knew how important this game was.
"Seven points from tonight's game and at Leicester last Saturday, I would have taken that beforehand.
"We respect Northampton massively - you have got to match their physicality - and we are certainly getting to where we need to be. We've got the win, and I am delighted."
Northampton director of rugby Jim Mallinder: "We made a good comeback and it was disappointing we did not get a bonus point, but we conceded two sloppy tries.
"Dylan Hartley and Soane Tonga'uiha both went close to tries, and we had some overlaps when we could possibly have done better, but it is still in our hands.
"We need to go down and beat London Irish on Saturday, it's as simple as that."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.