UCD all but secured their Premier Division status for next season when edging out basement side Galway United in a seven-goal thriller in Terryland Park, the win lifting Martin Russell's side 13 points clear of the struggling Tribesmen.
The home side started the brighter, but it was the Students who opened the scoring in the 11th minute when Dean Marshall sent Greg Fleming the wrong way from the penalty spot after Gary Kelly was adjudged to have pushed Paul Corry in the box.
United took just six minutes to get back on level terms, Alan Murphy turning Gary Curran's shot home from three yards, but the visitors got their noses in front in the 29th minute thanks to a howler from Fleming, who punched Darren Meenan's cross towards his own goal, with Graham Rusk getting the final touch on the line.
Rusk extended the visitors' advantage five minutes later, firing home from six yards after great work down the right by strike partner Robbie Benson as the United defence was marked absent, but Bobby Ryan threw the home side a lifeline just before half-time, getting on the end of Karl Moore's cross with a diving header which had too much power for Ger Barron in the UCD goal.
Cillian Morrison restored UCD's two-goal advantage, chipping Fleming from the edge of the box in the 78th minute, but the drama was not finished there.
Murphy got his second of the game from the penalty spot in the 82nd minute after David O'Connor pushed Mikey Gilmore in the box to set up a grandstand finish, but United couldn't find an equaliser.
Galway United -- Fleming; Preston-Kelly, Maher, Walsh, Kelly; Ryan, Curran, Sinnott (Dusi 69), Moore; Murphy, Caldwell (Gilmore 78).
UCD -- Barron; Nangle, Leahy, D O'Connor, Russell (Boyle 74); Marshall, P O'Connor, Corry (Morrison 57), Meenan; Rusk, Benson (Ledwith h-t).
Ref -- N Doyle (Dublin).