Ospreys 32 (19)
Justin Marshall showed his class at scrum-half for the Ospreys
Tries: S Williams, Hibbard.
Cons: Hook 2.
Pens: Hook 6.
Gloucester 15 (3)
Tries: Lawson, Lamb.
Scrum-half Justin Marshall masterminded a brilliant display as the Ospreys kept their Heineken Cup challenge alive by overpowering Gloucester in Swansea.
Shane Williams and Richard Hibbard claimed tries in each half, but the win was underpinned by 22 points from the boot of fly-half James Hook.
Replacement Gloucester scrum-half Rory Lawson scored a brilliant solo try, while Ryan Lamb got a late consolation.
But it was Marshall's control behind a dominant Ospreys pack that counted.
The Pool 2 rivals started cagily at the Liberty Stadium, punting the ball back and forth to avoid mistakes in the heavy rain blanketing Swansea.
Hook drew first blood for the Ospreys with a fifth-minute penalty, after Gloucester were caught with hands in the ruck.
Handling was always going to be tricky, but when Gavin Henson put up a huge Garryowen the Gloucester backs all left responsibility to each other.
The Ospreys centre, following up, leapt highest to gather the bouncing ball and only a fine cover tackle from Gloucester eight Gareth Delve dragged his fellow Welshman down short.
The home side recycled quickly, however, and wing Williams was on hand on the blindside to go over in the right corner, Hook adding a superb conversion.
Back came the Cherry and Whites and this time it was the Ospreys' turn to dither, as Lamb's chip ahead was allowed to bounce.
Marshall eventually collected the ball but the following clearing kick only found James Simpson-Daniel, the Gloucester wing running the ball back hard to set up a series of drives.
The Ospreys defence held firm and the Welsh side eventually worked their way back upfield, earning a penalty that Hook kicked for a 13-0 lead.
Lamb got Gloucester on the score-sheet as the half-hour approached with a penalty from in front of the posts.
But Hook restored the 13-point gap moments later when Delve was penalised for holding on under a pile of Ospreys tacklers.
A fine break from Marshall in his own 22 sparked a flowing move that saw Lee Byrne, Henson and Nikki Walker take play deep into Gloucester territory.
Peter Buxton unwisely went offside to slow possession and the Gloucester blind-side was sent to the sin-bin by referee Alan Lewis.
Hook made a fine kick from tight on the left touchline to give the Ospreys a 19-3 lead at half-time.
An impressive rolling maul from the Ospreys pack earned a penalty for Hook soon after the restart, but the fly-half blotted his perfect record by pushing the kick across the posts.
Gloucester counterpart Lamb was well short with a long-range effort and that saw Chris Paterson summoned from the bench to replace Leon Lloyd on the wing.
A break from the base of the scrum by Filo Tiatia saw the Ospreys number eight drive deep into the heart of the visitors' 22, who conceded another penalty that Hook gratefully slotted.
Gloucester head coach Dean Ryan sent on his second Scotsman, Lawson replacing Gareth Cooper at scrum-half, and it paid immediate dividends.
Lawson spotted a gap in the Ospreys defence from a line-out and he scorched away to the line, compatriot Paterson converting to bring Gloucester to within 12 points.
But unlike in their previous encounter at Kingsholm, where the Ospreys were in control but crumbled to lose badly, this time the Welsh brushed themselves off and redoubled their efforts.
Gloucester just kept their line intact with some determined tackling but lost Luke Narraway, who had only just arrived off the bench, to the sin-bin for dissent.
Hook kicked the resulting penalty, his sixth of the night, to make it 25-10 to the Ospreys in the 69th minute.
Worse was to follow for Gloucester as Olivier Azam swiftly followed Narraway to the sin-bin, after the French hooker took a swipe at Marty Holah in a ruck.
Ospreys coach Lyn Jones rang the changes to save his first choices for next week's trip to Bourgoin, but the replacements picked up the baton.
Mike Phillips, on for Marshall, made a fine break that eventually saw back-up hooker Hibbard shunted over by his pack, Hook adding the extras for a 32-10 lead.
Mike Tindall stabbed through a delicate kick for Lamb to claim a Gloucester consolation try, which went unconverted.
But both sides go into next week's final pool matches with realistic hopes of claiming quarter-final berths, Gloucester with the easier task at home to Ulster and the Ospreys in France to Bourgoin.
Ospreys coach Lyn Jones:
"Justin Marshall was man of the match by a country mile. I was on my feet applauding too - it was one of the best individual performances we've ever seen at the Liberty Stadium.
"That was as satisfying as any other game we have played in the Heineken Cup.
"I thought we were the better side for 70 minutes, and we have now played ourselves into a position of having to go to France next weekend and win a game of rugby."
Gloucester head coach Dean Ryan:
"It was obviously frustrating. We started poorly, we allowed them to build an early lead and we were far too late getting into the physicality of the contest.
"I am frustrated we ended up playing with 13 men. If one of the yellow cards was for swearing, then it is something that needs application across the game.
"The word Narraway used was not personal, as far as I know, and I have not read a law about swearing. I just need some clarity.
"We have got to get a bit angry during the week, become a bit more focused and use this result as motivation."
Ospreys: Lee Byrne; Nikki Walker, Sonny Parker, Gavin Henson, Shane Williams; James Hook, Justin Marshall; Duncan Jones, Huw Bennett, Adam Jones, Ian Gough, Alun Wyn Jones, Ryan Jones (capt), Marty Holah, Filo Tiatia.
Replacements: Richard Hibbard for Bennett (73), Paul James for A. Jones (73), Ian Evans for Gough (75), Jonathan Thomas for Tiatia (73), Mike Phillips for Marshall (73), Mark Taylor for Parker (75), Jonathan Vaughton for S. Williams (75).
Gloucester: Iain Balshaw; James Simpson-Daniel, Mike Tindall, Anthony Allen, Leon Lloyd; Ryan Lamb, Gareth Cooper; Christian Califano, Andy Titterrell, Carlos Nieto, Marco Bortolami (capt), Alex Brown, Peter Buxton, Akapusi Qera, Gareth Delve.
Replacements: Olivier Azam, Patrice Collazo for Califano (62), Luke Narraway for Qera (65), Alasdair Strokosch for Brown (12), Rory Lawson for Cooper (53), Chris Paterson for Lloyd (48), Willie Walker.
Sin Bin: Buxton (36), Narraway (68), Azam (71).
Referee: Alan Lewis (Ireland).