Bath overturned a 17-point deficit to secure a 33-24 Premiership win over neighbours Gloucester at Kingsholm.
Tries from Stephen Varney and Santiago Carreras helped Gloucester race ahead before a penalty try and a Miles Reid score started Bath's comeback.
While Seb Atkinson nudged Gloucester further ahead, Bath then scored 21 unanswered points through Reid, Joe Cokanasiga and Sam Underhill.
The win was only Bath's second away from home since April 2022.
Bath's only other win away from home since then came against Newcastle in November and while they stay 10th in the table, they have now closed the gap on their opponents a place above them to three points.
Varney's try gave the hosts the lead after five minutes after Louis Rees-Zammit broke Bath's defensive line in midfield and passed inside to the scrum-half to score.
A Carreras penalty for a Bath infringement at the breakdown stretched the lead to 10-0 while Bath stuttered in attack, with Tom Dunn knocking the ball on as he reached over the line in a bid to score their first try.
Carreras scored after another run from Rees-Zammit and kicked the conversion to push Gloucester 17 points clear inside 20 minutes, but when Gloucester captain Lewis Ludlow was sent to the sin-bin for a high tackle on Max Ojomah as he dived over in the corner, the television match official awarded the visitors a penalty try.
Reid then got Bath's second right before the break to close the gap to three points.
Atkinson scored for Gloucester as the hosts switched the ball across each side of the pitch, but it was to be their final score of the night as momentum went entirely Bath's way.
Cokanasiga scored Bath's third before Reid doubled his tally after replacement Underhill set him up to cross the line for the bonus point, and the England flanker went over himself from close range to add Bath's fifth and a memorable victory.
Gloucester, who were pushing for a top-four finish earlier in the spring, have now won only one of their past seven Premiership matches - with this their fourth league defeat in a row.
Gloucester: Carreras, Rees-Zammit, Harris, Atkinson, Thorley, Twelvetrees, Varney; Vivas, Blake, Ford-Robinson, Clarke, Alemanno, Clement, Ludlow (c), Morgan.
Replacements: Walker, Elrington, Knight, Jordan, Thomas, Chapman, Barton, May.
Sin bin: Ludlow (29)
Bath: De Glanville, Cokanasiga, Lawrence, Ojomah, Gallagher, Bailey, Spencer (c); Obano, Dunn, Stuart, McNally, Van Velze, Hill, Cloete, Reid.
Replacements: Annett, Morozov, Rae, Lee-Warner, Underhill, Green, Francis, McConnochie.
Sin bin: Francis (76)
Referee: Christophe Ridley