A late try from Gloucester's James Simpson-Daniel kept Gloucester's Heineken Cup hopes alive.
Simpson-Daniel clinched the crucial bonus point for Gloucester
The England winger scored his side's fourth try to clinch the bonus point that ensures the battle for top spot in Pool Five goes to the final weekend.
Gloucester can still overhaul Munster and clinch a home quarter-final.
Marcel Garvey, Duncan McRae and Henry Paul scored the other Gloucester tries, with Paul also kicking four conversions and three penalties.
Gloucester's final match if against Treviso at Kingsholm, which means the Cherry and Whites are perfectly placed to reach the last eight.
They got off to a perfect start against Bourgoin when Garvey scored the first try of the evening after just 20 seconds.
HEINEKEN CUP POOL FIVE
Bourgoin: (5) 18
Tries: Pape, Fritz
Drop Goals: Boyet 2
Gloucester: (13) 37
Tries: Garvey, McRae, Simpson-Daniel, Paul
Cons: Paul 4
Pens: Paul 3
When Henry Paul added the conversion - and then kicked two penalties - Gloucester were cruising at 13-0.
But Peter Buxton's sin-binning shortly before half-time for pulling down a maul allowed the hosts back into the game.
Lock Pascal Pape went over when Bourgoin drove the Gloucester pack back from a line-out to give the Frenchmen hope going into the half-time break.
Six minutes into the second half they were15-13 in front.
Christophe Laussucq landed a drop goal before Garvey threw the ball into the hands of centre Florian Fritz, who sprinted 40 metres to score Bourgoin's second try.
Paul nudged Gloucester back in front with a penalty before the visitors stepped up a gear in the final half-hour, with fly-half McRae running the show.
The Australian finished off good work from Paul and Robert Todd to score Gloucester's second try, which Paul converted.
Benjamin Boyet's drop goal hauled Bourgoin back into contention, but when Paul took McRae's pass to score with 17 minutes left, Gloucester's four-try target looked on.