A last-minute penalty from halfway by Elliot Daly gave Wasps a vital four points in their battle against relegation from Aviva Premiership Rugby.
Daly was called upon to take the crunch kick after former Gloucester player Nicky Robinson had missed with four penalties – and the nerveless centre hammered over the matchwinner at Adams Park.
With three games remaining, Wasps now have an eight-point lead over bottom club Newcastle, with the sides due to meet in the last match of the season at Adams Park.
Today's game was a tight affair which came to life in the second half. Wasps, inspired by Nic Berry and Billy Vunipola, were the better team in the first half and at one stage led 23-10. However, Luke Narraway and Johnny May underpinned an impressive Gloucester rally which saw them lead until Daly's late effort.
Wasps took the lead in the first minute through a simple penalty from Robinson after Gloucester were penalised straight from the kick-off.
This was soon followed by an excellent solo try from Berry. Vunipola quickly took a tap penalty and from the ensuing ruck, the scrum-half darted past some poor Gloucester defence for a try which Robinson converted for a 10-0 lead after five minutes.
The visitors had their first chance for points but Freddie Burns' penalty attempt from halfway fell narrowly short. The Cherry and Whites' outside-half was then given another opportunity – and this time made no mistake from 40 metres.
Robinson had a chance to nullify that score but missed a 30-metre penalty before Gloucester levelled the scores with their best move of the match. A pass from Burns was almost intercepted by Tom Prydie but it did put James Simpson-Daniel through the gap and the visitors made the most of that momentum to send Scott Lawson over for a try which Burns converted.
Back came Wasps and Robinson had two penalty chances just before half-time. The first from 35 metres was successful but the second, a more difficult one from the touchline, rebounded back off a post to leave his side with a deserved 13-10 lead at the interval.
Early in the second half, Robinson was on target with his third penalty from 30 metres before Wasps scored a splendid try. Berry broke away from a ruck deep inside his own half to run 40 metres and feed Prydie.
The wing beat two defenders on a weaving run before some skilful passing created a try for Hugo Southwell which Robinson converted.
A stunned Gloucester responded immediately with seven points of their own. Clever interplay from Narraway and Nick Runciman gave Charlie Sharples an easy run-in for a try which Burns converted. The score was the prelude for the visitors to dominate the next 15 minutes and camp in the opposition 22 – but Wasps' defence held firm.
However Gloucester took the lead with a superb try 15 minutes from the end. May, on his own 22-metre line, fielded a Robinson kick and then ran 70 metres before feeding Henry Trinder, who sent Akapusi Qera in for the try which Burns converted.
In the closing stages, Robinson failed with an easy 25-metre penalty and then a 45-metre attempt – before Daly's late strike secured a vital win for Wasps.