It was a dramatic day at Kingsholm. The visitors led 15-3 at the break after tries from Craig Mitchell and Matt Jess.
Gloucester battled back in the second half with three tries in quick succession from James Simpson-Daniel, Freddie Burns and Nick Runciman to lead 27-18 with 20 minutes remaining.
But Gareth Steenson's penalty and a last minute Alistair Muldowney try, converted by Steenson, won the game by the narrowest of margins.
It was Exeter's first ever win at Kingsholm, and moves them closer to a top four finish and qualification for next season's Heineken Cup.