Owen Heary scored a late winner to put Shelbourne two points clear at the top of the Premier Division table for Christmas and break UCD hearts.
College were magnificent for large parts of this thrilling match but ultimately ended with nothing as Shelbourne left Belfield knowing they had stolen the points.
Shelbourne, conscious of defeat the last time they met the Students, started positively and got their reward in 16 minutes with the lead goal.
Barry Ryan initially did very well to make a parry save from Stephen Geoghegan after Pat Fenlon picked out his striker with a clever little pass.
But the ball broke back kindly for Geoghegan, who followed up to drill home.
UCD's heads never dropped, though, and they played their way back into the game. Seβn Finn, starting in place of Ciaran Martyn after scoring in the mid-week cup win over Drogheda, looped a header over and then forced a good stop from Steve Williams before College got their deserved equaliser on 42 minutes. Darragh Ryan sent over a perfect free kick to the back post where Clive Delaney arrived to head to the net.
The second half was end to end, with UCD having the edge. Finn cracked a stunning shot off the crossbar and then forced a good save from Williams before putting UCD in front on 73 minutes.
Kevin Doherty fouled Robbie Martin and Finn found the top corner with a superbly struck 30-yard shot.
Doherty quickly made amends by getting forward to equalise when heading home Fenlon's corner four minutes later.
Heary then won it for Shelbourne on 87 minutes. Delaney's poor headed clearance from John Burns' cross fell at the Shelbourne captain's feet and he drilled the ball low into Ryan's bottom left-hand corner.
UCD: B. Ryan; Keating, Delaney, McAuley, D Ryan; Doolin, McNally, O'Donnell; J Martin, Finn, R Martin. Subs: Grogan for R Martin (79 mins), McDonnell for Finn (85),
SHELBOURNE: Williams; Hutton, McCarthy, Doherty, Heary; Houlihan, Crawford, Gannon, Fenlon, Minnock, Geoghegan. Subs: Burns for Minnock, D Byrne for Houlihan (both 61 mins), Gritton for Gannon (86).
Referee: H. Whoriskey (Dublin).