In response Leinster managed a late try from Fergus McFadden, with Ian Madigan scoring the rest of their points but Ulster's dominance in the scrum proved the difference between the sides.
Ulster had the better of the opening exchanges but could not take advantage, while Leinster were clinical with every opportunity.
Madigan knocked over two penalties in the opening quarter, both from wide on the right, to put his side into a 6-0 lead.
By comparison Paddy Jackson missed a couple of early shots at goal, but when it came to the third attempt, after 25 minutes, he made no mistake to reduce the deficit to three.
And on the back of a powerful Ulster scrum, Ruan Pienaar levelled the scores with a long-range penalty on the half-hour.
However Leinster hit back immediately through another Madigan penalty from straight in front when Iain Henderson was penalised for coming in at the side.
Leinster's ability to score with every chance they got was the reason they led but with three minutes left in the half Ulster took the lead for the first time.
The home pack was in complete control at the set-piece and when they earned a five-metre scrum another powerful drive from the Ulster eight left George Clancy with no choice but to give a penalty try, Pienaar converted to make it 13-9 at the break.
Leinster pulled three points back immediately after half-time when Darren Cave was penalised for not rolling away.
However Ulster responded with their second try of the game when Williams barged and twisted his way to just get the ball on to the line. Pienaar's conversion made it 20-12.
The home scrum remained dominant and on the hour mark it earned Ulster another penalty but Pienaar missed from the kicking tee for the first time.
Ulster looked in control but from a Leinster attack Rory Best was sent to the sin bin for failing to roll away, Madigan missing the ensuing penalty.
And despite being a man down it was Ulster who scored again. After some good work from the pack Pienaar produced an exquisite cross-kick for Trimble to collect and score the home side's third, the South African's conversion made it 27-12.
Leinster hit back with a try from replacement McFadden as the ball was spread wide by Madigan, who slotted the conversion to reduce the deficit to eight points.
However they could not find another score and ended up leaving Ravenhill empty-handed to lose their third consecutive game in all competitions.
|Ulster Rugby Score Card|
|Leinster Rugby Score Card|