Serge Atakayi scored another opportunistic winner as St Patrick's Athletic had to work hard for a big three points at the UCD Bowl.
The victory saw Tim Clancy’s side edge to within four points of third-placed Derry City in their quest for European football again next year.
Finn Harps beating Sligo Rovers sees UCD drop back to the bottom of the table, two points behind the Donegal side.
Making his first start in four months following injury, Saints' striker Ronan Coughlan had an early chance to mark his return in style on seven minute from a set-piece routine.
Anto Breslin’s corner was flicked by Chris Forrester for Coughlan whose shot took a deflection to balloon over the top.
But Saints fans didn’t have much longer to wait for the lead as they scored from Forrester's delivery from a second corner.
Skipper Joe Redmond’s looped header back across goal came back off a post with Dutchman Thijs Timmermans, whose name the St Pat’s fans had chanted minutes before, nodding home his first goal for the club.
The guile of Tommy Lonergan, a former St Pat’s academy player, carved a half chance out of nothing on 27 minutes as UCD played their way into the game.
Cleverly hooking the ball over Tom Grivosti, the 18-year-old College striker’s volley dipped wide of Danny Rogers’ right-hand post.
That signalled a spell of pressure from the home side with Mark Dignam shooting off target after St Pat’s failed to clear.
Rogers was then called to make a fine reaction save when UCD captain Sam Todd’s header from an Evan Caffrey corner took a deflection.
That reawakened St Pat’s and they were inches from extending their lead on 38 minutes.
UCD’s left-back Evan Osam initially made a fine block on a shot from Coughlan.
The ball fell to Harry Brockbank who blasted a shot off the UCD crossbar.
A minute later, UCD broke with Mark Dignam drilling narrowly wide of a post from distance.
Sean Brennan then improvised superbly to flick wide with an overhead kick of sorts from Alex Dunne’s cross.
The lively Longeran had another couple of sights of goal as the half came to a close.
First, he fired wide following Duffy’s incisive run before then finding a pocket of space himself to run on goal and again shoot just past a post.
And while UCD began the second half promisingly, a defensive blunder gifted St Pat’s a decisive second goal on 51 minutes.
Brockbank’s long ball appeared to pose no threat. But poor communication at the back by UCD saw Michael Gallagher’s back header bounce past advancing goalkeeper Kian Moore.
As he was in scoring against CSKA Sofia and Sligo Rovers recently, Atakayi was fully alert to the opportunity, racing through to tap home his third goal for the club.
UCD hit back eight minutes later, Dylan Duffy’s superb free kick finding the net past the wall and through a crowded area.
But it was St Pat’s who finished strongly, Atakayi bringing a fine save one-on-one from Moore.
The impressive Redmond then powered a header from a Billy King corner off a post before Moore again saved well from Barry Cotter at the death.
UCD: Kian Moore; Alex Dunne (Danny Norris 79), Michael Gallagher, Sam Todd, Evan Osam; Evan Caffrey, Donal Higgins (Alex Nolan 60); Mark Dignam (John Ryan 60), Sean Brennan, Dylan Duffy; Tommy Lonergan.
St Patrick’s Athletic: Danny Rogers; Harry Brockbank, Joe Redmond, Tom Grivosti, Anto Breslin; Jamie Lennon,Thijs Timmermans (Adam O’reilly 72); Barry Cotter, Chris Forrester (Billy King 85), Serge Atakayi; Ronan Coughlan (Eoin Doyle 57).
Referee: Oliver Moran (Dublin).