Connacht kept their Champions Cup hopes alive and dealt a massive blow to Gloucester's as Robin Copeland's last-gasp try earned a 27-24 win in Galway.
Gloucester seemed certain winners as they led 24-13 after 76 minutes but Shane Delahunt's try gave Connacht hope before Copeland's injury-time winner.
Two second-half Mark Atkinson tries either side of a Lewis Ludlow score seemed to have sealed a Gloucester win.
Gloucester stay second in Pool Five despite their third defeat.
The Premiership club earned two points from the Sportsground contest after scoring four tries - including Gerbrandt Grobler's first-half score.
Caolin Blade scored a first-half try for Connacht, who move to eight points having had two wins and two defeats in their opening four games.
Table toppers Toulouse face Montpellier later on Saturday afternoon.
Connacht struggle to break down Gloucester
Helped by a strong wind, Connacht dominated possession in the first half but struggled to break down a well-organised Gloucester defence despite the visitors having made nine changes from last weekend's 26-17 win over the Irish province at Kingsholm.
Gloucester looked dangerous on rare forays into Connacht territory but handling errors saw a couple of scoring opportunities being squandered - notably a 22nd-minute chance for Ruan Ackermann.
The visitors didn't punish Eoin McKeon's early sin-binning for a deliberate trip as lively fly-half Conor Fitzgerald kicked the home side into a 3-0 lead during the flanker's absence.
In contrast, Connacht did exploit Gloucester hooker Todd Gleave's 10-minute absence for persistent infringements as scrum-half Blade finished off a period of sustained pressure with his 30th-minute try to put the home side 10-0 up.
However, Gloucester hit back immediately with Grobler touching down after Connacht's failure to clean up the restart had put them under pressure.
Gloucester moved ahead 12 minutes after the restart as centre Atkinson easily intercepted a looping Kyle Godwin pass in the Connacht 22.
As the wind continued to blow, Billy Twelvetrees hit the post with the conversion from in front of the posts and Connacht regained the lead three minutes later as Fitzgerald slotted a penalty.
But Gloucester were back in front in the 69th minute as wing Louis Rees-Zammit's superb offload to scrum-half Callum Braley was finished off by skipper Ludlow's finish, with Twelvetrees' extras increasing the lead to 19-13.
The contest looked over two minutes later as Ollie Thorley's mazy run set up a chance finished by Atkinson's touchdown, as Gloucester's fourth try banked a bonus point.
However, prop Finlay Bealham's break from deep rallied the home side and Connacht were given a further lifeline when Gloucester flanker Ludlow was sin-binned following an infringement with five minutes left.
From the resultant penalty, Connacht mauled their way over the Gloucester line as replacement Delahunt produced the finish.
After Fitzgerald landed the extras, Connacht's Tom Daly won the crucial restart as Bundee Aki made headway into Gloucester territory.
Another Aki surge saw Connacht reach the edge of the Gloucester 22 and after the ball was recycled, Daly's offload allowed the overlapping Copeland to notch the match-winning try as the contest entered injury-time.
Connacht: Carty, Adeolokun, Godwin, Aki, Porch, Fitzgerald, Blade; McCabe, Heffernan, Robertson-McCoy, Dillane, Maksymiw, McKeon, Butler, Boyle.
Replacements: Delahunt, Buckley, Bealham, Murray, Masterson, Kerins, Daly, Copeland.
Gloucester: Banahan, Rees-Zammit, Twelvetrees, Atkinson, Thorley, Evans, Braley; Hohneck, Gleave, Balmain, Craig, Grobler, Clarke, Ludlow, Ackermann.
Replacements: Marais, Seville, Ford-Robinson, Mostert, Morgan, Simpson, Cipriani, Harris.
Referee: Romain Poite (Fra) Assistants: Vincent Blasco Baqué (Fra), Adrien Descottes (Fra) TMO: Denis Grenouillet (Fra)