Ulster turned around a 12-point deficit to take Ospreys' unbeaten record in a bruising encounter in Swansea.
Fly-half Dan Biggar kicked four penalties to give the table-topping Ospreys a 12-0 lead after 44 minutes.
But Ulster kept their cool and a superb forward display enabled their number 10 Paddy Jackson to kick six penalties.
A desperate last-minute attack by the Ospreys ended in a knock-on, as the visitors held on for their second successive win at the Liberty Stadium.
In a match that lacked nothing in commitment but offered little in terms of creativity, it was the perfect place-kicking displays of both fly-halves that caught the eye.
Scrum V analyst Sean Holley casts his eye over Ulster's 18-12 win over Ospreys at the Liberty Stadium
But the result was a blow for the Ospreys as they prepare to meet Leinster in the Heineken Cup, while the result will boost Ulster, with Leicester their next opponents in the same competition.
The clash between the unbeaten Ospreys and last season's beaten finalists quickly settled into a pattern of straight running and ferocious defence.
Ulster talisman Nick Williams had difficulty making headway against the blitzing Ospreys defenders, with Ian Evans and Joe Bearman in particular catching the eye with big hits on the powerful Kiwi.
The visitors dominated possession for long periods, and went through phases with patience and precision, but could not make the breakthrough.
And they were further hindered when full-back Craig Gilroy limped off in the 13th minute to be replaced by David McIlwaine, who had come onto the bench just before kick-off when Darren Cave was drafted into the starting line-up to replace the ill Jared Payne.
Ospreys had the clearer chances, firstly when Bearman stole possession at a maul but held on with Ryan Bevington clear on his outside.
Ulster hooker Rory Best tells Scrum V's Phil Steele he's delighted with the 18-12 win over Ospreys in Swansea
And Justin Tipuric was caught in front of the ball-carrier after centre Ashley Beck made a clean break.
But the only points of the first half came from the boot of home fly-half Biggar, first when Williams was penalised at a ruck and again on the stroke of half-time when Dan Tuohy was adjudged to have impeded Alun Wyn Jones by the television match official.
Further indiscipline from Ulster saw them trailing by 12 points after four minutes of the second half as Biggar again punished them.
But Ulster, with Tuohy and captain Johann Muller to the fore, gradually clawed their way back into the game courtesy of Ospreys indiscipline and the unerring right boot of fly-half Jackson.
Ulster were back level in the 63rd minute as Jackson kicked his fourth penalty.
And the pressure on the Ospreys took its toll as Jackson was on target again in the 73rd and 77th minutes to give Ulster a six-point cushion.
With Aaron Jarvis in the sin-bin, 14-man Ospreys mounted a frantic attack which Ulster just managed to repel on the tryline, at the expense of a yellow card for Stuart Olding.
One final scrum on the Ulster line was demolished by the Ospreys, but an offside decision confirmed Ulster's hard-earned win.
Richard Fussell; Jeff Hassler, Andrew Bishop, Ashley Beck, Eli Walker; Dan Biggar, Tito Tebaldi; Ryan Bevington, Richard Hibbard, Adam Jones, Alun Wyn Jones (Capt), Ian Evans, Tyler Ardron, Justin Tipuric, Joe Bearman.
Scott Baldwin, Duncan Jones, Aaron Jarvis, James King, Sam Lewis, Tom Habberfield, Matthew Morgan, Ben John
: Craig Gilroy; Andrew Trimble, Darren Cave, Luke Marshall, Mike Allen; Paddy Jackson, Paul Marshall; Tom Court, Rory Best, Declan Fitzpatrick; Johann Muller (capt), Dan Tuohy; Robbie Diack, Chris Henry, Nick Williams.
R Herring, C Black, B Ross, I Henderson, R Wilson, M Heaney, S Olding, David McIlwaine.
Peter Fitzgibbon (IRFU)
Jon Mason, Wayne Davies (both WRU)
Dennis Jones (WRU)
Derek Bevan (WRU)