All Black Stephen Donald scored the first try of the game after just 40 seconds. The New Zealander found a gap and showed great pace to touch down for Bath after a 40-metre run-in.
Having started the match brightly, Bath launched another attack with Nick Abdendanon touching down, only to have his score ruled out for a foot in touch.
Donald, having taken over kicking duties from the departed Olly Barkley, added a penalty shortly after to extend Bath's lead to 10-0.
Gloucester hit back with two Freddie Burns penalties, narrowing the half-time deficit to 10-6.
The Cherry and Whites had a try of their own disallowed early in the second half, with in-form Shane Monahan having a score ruled out for double movement after a last-ditch tackle from Tom Biggs.
Gloucester took the lead four minutes later, with Rob Cook touching down in the left corner and Freddie Burns adding the conversion.
Burns gave Gloucester some breathing space with a 75th minute drop goal to put his side 16-10 up.
All Black debutant Jimmy Cowans gave away possession to Bath in the final play of the game, but Bath failed to capitalise and Gloucester held out for the win.