Ulster boosted their chances of making the Pro12 play-offs as they held off the severely understrength Ospreys.
The Ospreys, who remain second in the table despite the defeat, took an early lead thanks to Joe Bearman's try.
A controversial penalty try - with Dan Biggar yellow carded - helped the home side lead 10-7 at half-time.
Biggar was missing as Paddy Wallace scored Ulster's second try but the home side had to hang on frantically after Eli Walker's late try at Ravenhill.
Walker ran in his superb solo score in the 79th-minute and the Ospreys still had time to produce more intense pressure when Biggar's cross-kick had the Ulster defence scrambling before John Afoa kicked the ball dead to end the contest.
Ulster's win moves them to fourth in the table with six rounds of matches to follow, while the Ospreys stay second - a point ahead of Munster - thanks to the losing bonus point.
Ruan Pienaar missed an Ulster penalty in the 11th minute and the home side suffered a blow three minutes later when Pedrie Wannenburg was yellow-carded for an apparent trip on Kahn Fotuali'i.
The Ospreys exploited the man advantage fully as Bearman squeezed over the line, with Biggar converting, after a series of rucks.
Pienaar opened Ulster's account before the half hour and Ulster managed to fashion a fortunate lead by the break as pressure near the Ospreys line led to referee Neil Hennessy awarding a penalty try.
Hennessy adjudged that Biggar had deliberately knocked the ball down as Ulster attacked near the Ospreys line but it looked a questionable decision.
Biggar was yellow-carded and he was still missing eight minutes into the second half when Afoa's clever pass set up Wallace to score in the left corner.
The Ospreys continued to look dangerous with Ulster full-back Stefan Terblanche making a crucial try-saving tackle on Hanno Dirksen just before the hour mark.
Despite Ospreys pressure, Ulster appeared comfortable enough in the closing minutes before Walker beat three tackles to score a superb try.
Biggar's conversion cut Ulster's lead to a solitary point and the Ospreys nearly snatched victory in injury-time before Afoa cleared to safety after the fly-half's cross-kick over the home defence.
Ulster: S Terblanche; C Gilroy, N Spence, P Wallace, I Whitten; R Pienaar, P Marshall; P McAllister, A Kyriacou, J Afoa, L Stevenson, D Tuohy, C Henry (capt), W Faloon, P Wannenburg.
Replacements: S Danielli for Gilroy 63, C Black for McAllister 72, N Brady for Kyriacou 72, A Barker for Stevenson 70, R Diack for Wannenburg 53, A D'Arcy for Danielli 73.
Not Used: Macklin, Humphreys.
Ospreys: R Fussell; H Dirksen, A Bishop, S Watermeyer, E Walker; Biggar, K Fotuali'i; D Jones, S Baldwin, J Rees, I Gough, J King, T Smith (capt), S Lewis, J Bearman.
Replacements: M Morgan for Fussell 64, A Beck for Watermeyer 55, R Webb for Fotuali'i 66, R Bevington for D Jones 46, J Thomas for Gough 50, G Stowers for Bearman 64.
Not Used: M Davies, W Taylor.