Terenure survived a fierce test from UCD to make it six wins from six this season and stretch their unbeaten run to a remarkable 29 games, dating back to February 2013.
They went in front for the first time six minutes from the end after UCD had twice led by nine points.
After a messy opening period, UCD went 12-0 up in the space of two first-half minutes. First scrum-half Nick McCarthy burrowed over from close range after some sustained pressure on the Terenure line.
Then on 24 minutes, Garry Ringrose broke Terenure’s defensive line to offload to Billy Dardis who fed Sam Coghlan-Murray for a finish in the corner.
Terenure finally got off the mark in the 43rd minute when James Thornton landed a penalty from 32 metres.
Four minutes after the break they reduced the margin to four points when centre O’Neill scrambled over in the corner.
Coghlan-Murray pushed the lead out to nine points again after Peadar Timmins’ long looping pass but Terenure didn’t panic, and after an O’Neill penalty nudged them closer, tries from O’Donoghue and Robert Duke in the last 10 minutes got them over the line.
Scorers for UCD: McCarthy (try) Coghlan-Murray (2 tries); Byrne (con)
Scorers for Terenure College: S O’Neill, O’Donoghue, Duke (1 try each); Thornton (pen), M O’Neill (2 pens, con)
UCD: B Dardis; S Coghlan-Murray, G Ringrose, H McNulty, A Byrne; R Byrne, N McCarthy; G Frayne, R Byrne, L Hyland; R Molony, E MacMahon; J Murphy, D Lawler, P Timmins.
Replacements: S O’Meara for McNulty (63), J Harrison for R Byrne (72), G Thornbury for MacMahon (75)
TERENURE COLLEGE: I Hanley; J O’Donoghue, S O’Neill, S Donovan, H Moore; J Thornton, K O’Neill; G Hamilton, R Smyth, O Heffernan; F Walsh, J Dever; R Duke, J O’Neill, K McCoy.
Replacements: A Dunlop for Donovan (50), K Buckley for Smyth (56), M O’Neill for Thornton (62), W Devane for Dever (72)
Yellow cards: Duke (52)
Referee: Nigel Correll.