Glasgow secured their first win at the Liberty Stadium despite a late fightback by the Ospreys.
Hanno Dirksen crossed for the game's opening try but tries from John Walsh and Colin Shaw gave Glasgow a 20-10 interval lead.
Rory Jackson added two further penalties to Glasgow's total in the second half although they had two men yellow carded.
Kahn Fotuali'i scored the home side's second try but the visitors held on.
The loss was the Ospreys' first home league defeat since April 2011 as Glasgow boosted their play-off hopes.
After a scrappy opening it was the Ospreys who had launched the first genuine attack.
Scrum-half Rhys Webb was alert to take a quick tap on halfway and worked his way down the right flank to feed Dirksen, but the wing was superbly tackled into touch just short of the line by flanker Chris Fusaro.
Glasgow responded by taking the lead through a 13th-minute Jackson penalty after strong running from centre Dunbar.
The lead lasted barely two minutes as Dirksen made up for his earlier failure to make the line by shrugging off a weak tackle from David Lemi to canter over from halfway.
Dan Biggar converted the try but Glasgow regained the lead just a couple of minutes later.
Ospreys wing Eli Walker was harshly penalised for his aerial challenge, and the visitors took full advantage with a controlled driving maul from the resulting line-out leading to a try for Welsh which Jackson converted.
The Warriors soon launched another bright attack with Dunbar making more inroads in the Ospreys midfield.
The centre's charge led home skipper Tom Smith to concede the penalty for illegally slowing the ball down, earning himself a yellow card as Jackson slotted his second penalty to make it 13-7.
Glasgow were by far the sharper side in attack and made the most of their man advantage by adding their second try six minutes before the break.
Dunbar was yet again the man doing the damage, and when the ball was recycled scrum-half Henry Pyrgos was given far too much room to send Shaw to the line for a converted score.
Biggar trimmed the gap to seven points with penalties either side of half-time, but Jackson replied with one of his own shortly after missing from distance.
The Scotland international was also off target with a much simpler effort just before the hour as the visitors forced another scrum penalty out of their hosts.
Wales prop Ryan Bevington saw yellow for driving away Tom Ryder's support lifters at a line-out, and Jackson added another three points.
The Warriors thought they had claimed a third try as full-back Peter Murchie cut through to touch down, but referee Neil Paterson called play back for blocking and dispatched captain Al Kellock to the sin bin after an off-the-ball scuffle.
Replacement Johnnie Beattie then joined his skipper on the sidelines with seven minutes to play after he was ruled to have tip-tackled Dirksen.
The home side used the numerical advantage to set up a tight finish as replacement Fotuali'i went over.
But their late rally came to nothing and Jackson missed another penalty attempt with the final kick of the game.
Ospreys: Ross Jones, Hanno Dirksen, Andrew Bishop, Ashley Beck, Eli Walker; Dan Biggar, Rhys Webb; Ryan Bevington, Richard Hibbard, Joe Rees, Ian Gough, James King, Tom Smith (capt), Sam Lewis, Joe Bearman.
Replacements: Matthew Morgan for R. Jones (66), Tom Isaacs for Bishop (60), Kahn Fotuali'i for Webb (63), Aaron Jarvis for Rees (53), Jonathan Thomas for King (46), Will Taylor for Lewis (71), George Stowers for Bearman (53).
Not Used: Scott Baldwin.
Glasgow: Peter Murchie, David Lemi, Alex Dunbar, Federico Aramburu, Colin Shaw, Ruaridh Jackson, Henry Pyrgos, Ryan Grant, Dougie Hall, Jon Welsh, Tom Ryder, Al Kellock (capt), Calum Forrester, Chris Fusaro, Ryan Wilson.
Replacement: Seymour for Shaw (40), Reid for R. Grant (54), MacArthur for Hall (54), Kalman for Welsh (66), Verbakel for Ryder (66), Harley for Forrester (40), Beattie for Wilson (66).
Not Used: Wight.
Referee: Neil Paterson (SRU)
Assistant Referees: Gwyn Morris, David Jones (both WRU)
Citing Commissioner: John Charles (WRU)
TMO: Paul Adams (WRU)