Ulster made it back-to-back wins in the PRO14 to keep their playoff hopes alive after shading a tight encounter with Ospreys 8-0 at the Kingspan Stadium.
They left it late to secure the four points with Jacob Stockdale profiting from a spilt ball in the last minute to run in near the posts for an unconverted try.
Even though Ulster dominated in the second half, after leading 3-0 at the break through John Cooney's early penalty, they failed to score on a number of occasions after turning down kickable shots at goal.
This was Ospreys' first defeat in five games and it marked interim coach Allen Clarke's first visit to the Kingspan since departing last season.
Stockdale's try denied the Welsh side a losing bonus point in their chase for a Champions Cup place next season.
Ospreys were left to rue having a first-half try ruled out by the TMO and a missed penalty by Dan Biggar - their only kick at goal - while Ulster also had a score turned down in the second half.
Cooney opened the scoring for the home side with a sixth-minute penalty after a stray Ospreys boot had kicked the ball out of a ruck.
Ulster then came close to scoring a try two minutes later only for Dan Evans to beat Johnny McPhillips to the touchdown after the out-half put in a grubber kick under Ospreys' posts.
Biggar was off target with his first shot at the posts in the 21st minute and, on the half hour, Ospreys centre Kieron Fonotia got on the end of a break to dummy Charles Piutau and score under the posts.
Referee Andrew Brace, though, consulted with the TMO over a neck roll by Alun Wyn Jones on Iain Henderson and the score was ruled out.
Ulster's response nearly saw Mattie Rea make the line only for Piutau to be held just short and Ospreys won a penalty to relieve the pressure.
Ulster blew another scoring chance off a five-metre scrum after Louis Ludik had nailed Hanno Dirksen behind his goal line - Piutau's offload missing Stockdale.
However, after Evans was buried by Cooney behind his own line, Ulster won another five-metre scrum, after 57 minutes, the result seeing Jeff Hassler yellow-carded for not rolling away.
Again, though, Ulster ignored the three points and went for the scrum, only to give away a penalty when substitute Andy Warwick went off his feet.
Luke Marshall's chip for replacement Nick Timoney saw the flanker get over the line in the 68th minute, only for it to be ruled out after the TMO was consulted.
Then, with time nearly up, Ospreys spilt a ball and Stockdale grabbed it and ran in unopposed, with Cooney missing the extras.