Northampton dramatically ended a run of seven successive Aviva Premiership defeats as they stunned Gloucester at Franklin's Gardens.
Referee Ian Tempest awarded Saints an 80th-minute penalty try when Gloucester collapsed a maul, which was enough to secure a 22-19 victory.
Saints had claimed just one win from their previous 13 games in all competitions, but they stuck to their task and denied Gloucester a chance of going second in the table.
A first-half penalty try and touchdown from hooker James Hanson sent Gloucester on their way, while prop John Afoa's 53rd-minute score looked to have proved the difference.
Fly-half Owen Williams added one conversion, but tries by wing Ken Pisi and scrum-half Nic Groom, plus a Harry Mallinder conversion and penalty, kept Saints in the hunt and underpinned a winning start for recently-appointed technical coaching consultant Alan Gaffney.
Tempest consulted television replays during the closing seconds when it looked as though Saints had scored a try, but they proved inconclusive and he went for the penalty try call instead, while also sin-binning Gloucester centre Andy Symons.
Northampton needed to make a confident start in pursuit of a first league win since late September, and they duly obliged, delivering an 11th-minute try after Williams missed a penalty chance for Gloucester.
England lock Courtney Lawes was heavily involved in the build-up, before Saints drew in Gloucester's defensive numbers and Pisi finished impressively.
Mallinder's conversion attempt hit the post, but the Gloucester forwards then stirred into action as they drove a lineout relentlessly onwards from 25 metres out, with Tempest awarding a penalty try when Saints collapsed the maul.
The seven-point score put Gloucester ahead, and they also gained a temporary one-man advantage as Tempest sin-binned Northampton lock Api Ratuniyarawa for his role in illegally halting an irresistible charge.
Gloucester, though, did not score when Ratuniyarawa was off, and Mallinder edged Saints back in front when he kicked an angled 26th-minute penalty.
But unsurprisingly, Saints visibly lacked confidence at times, and Gloucester punished them with a second try as they moved possession wide - the officials missed Williams holding back a covering defender - and Hanson crashed over from close range.
Williams kicked the conversion, giving Gloucester a 14-8 interval advantage and leaving Saints with it all to do as they strived to rediscover a winning formula.
Northampton suffered an injury blow early in the second period when centre Luther Burrell was helped off -- Tom Stephenson replaced him -- and it proved an immediate defensive shift for the substitute as Gloucester looked to extend their lead.
And the visitors did not have to wait long, with flanker Jake Polledri smashing through Northampton's front-line defence to free Williams, whose half-break and delicious off-load found Afoa, and the former New Zealand international prop enjoyed a clear scoring run.
Gloucester, though, saw their breathing space prove shortlived as Saints hit back following patient phase-play and then Groom sniping over for a try that Mallinder converted as Saints entered the final quarter just four points adrift.
Northampton and England captain Dylan Hartley was substituted in the 54th minute, making way for Mikey Haywood, and then Saints belatedly came up trumps to leave Gloucester reeling.