A controversial penalty, that Brandywell manager Kevin Mahon later admitted was harsh, put Derry City on the road to maximum points against UCD on Saturday night.
Having criticised his side's first-half performance, Mahon's halftime team talk seemed to lift his players and Derry were rarely in difficulty in the second period.
But Derry had to wait until the 93rd minute to make the game safe and it was 19-year-old substitute Darren McCaul who sealed the win with a stunning strike.
The youngster, who agreed a new five-year contract last weekend, latched onto Eddie McCallion's through ball and McCaul's pace saw him turn a UCD defender before delicately lobbing the ball over goalkeeper Barry Ryan.
However, the game's turning point centred on that controversial penalty decision in the 35th minute. UCD's towering centre-half, Clive Delaney, was adjudged to have pushed Michael McHugh as the Derry striker burst into the penalty area. Liam Coyle stepped up to send Derry in front, placing the spot kick low into the corner of the net.
"I felt it was a harsh decision," said Mahon. "Michael seemed to lose control of the ball just before contact was made. But that said, I thought we had a more justified claim for a penalty in the second half when Gary Beckett was fouled and we didn't get that decision."
He agreed that his side were fortunate to be in the driving seat at half-time and admitted his concern at Derry's performance over the first 45 minutes.
"I don't think we deserved to be in front at that stage, but once we had a chat during the interval, a few things were sorted out and in the second half I didn't think we were in too much trouble.
"It was a significant result for us, considering the fact that Shelbourne were beaten and Finn Harps held to a draw in Bray. The win will stop us looking over our shoulders and now we can concentrate on moving up the table again."
UCD's front-man Mick O'Byrne tested Derry goalkeeper David Platt with just two shots throughout the 90 minutes, the students' only worthwhile scoring efforts.
Derry City: Platt; D Kelly, Curran, Hutton, M Kelly; Doherty, Hegarty, Beckett, Hargan; Coyle, McHugh. Subs: McCallion for D Kelly (60 mins), McCaul for Coyle (80 mins).
UCD: Ryan; McLoughlin, Mahon, Delaney, McAuley; Bennis, Kavanagh, Lynch, Dunne; O'Byrne, Kilmurray. Subs: Martin for Dunne (63 mins), O'Toole for Kilmurray (80 mins).
Referee: P McKeon (Dublin).