Replacements: Kieran Moloney, Risteard Byrne, Adam Clarkin, Jamie Glynn, Niall Earls.
Replacements: John Mark Griffin, Peter O'Shea, Mark Hanrahan, Darren Mulcair, Alan Gaughan, Eamonn Connolly.
Garryowen, whose opening scores came from two Jamie Gavin penalties, were much improved after the break and hit back through captain Rory Brosnan's converted try.
And following a late rally, winger James McInerney dived over at the death with Alan Gaughan's conversion earning the visitors a losing bonus point.
Although UCD prevailed 25-11 when the teams last met back in October, the form of both these sides going into this game could not have been more contrasting.
Despite being bottom of the league having lost their opening 10 matches, Garryowen had won their previous two fixtures in February with former Ireland head coach Eddie O'Sullivan now assisting the Limerick club's management team.
UCD, who started the season so impressively, had hit a stumbling block recently, suffering six defeats in their last seven league games and they were looking to end a four-match losing run.
Therefore it was no surprise that an early exchanges were tight and tense and it was 3-all after out-half Thornton had kicked a drop goal and Garryowen's Gavin landed a penalty.
The hosts grew into the game with two Thornton penalties stretching their lead before the opening try arrived on 18 minutes.
Full-back Boyle went on a mazy run in midfield to dart through the visiting defence and cross the whitewash. Thornton added the extras to give UCD a 16-3 advantage.
Gavin replied with a penalty to cut the deficit, but the students were well on top and scrum half Luke McGrath almost scrambled over after the restart.
And following another Thornton penalty, try number two arrived in the 28th minute courtesy of right winger Dix diving over in the corner.
Thornton continued his fine kicking display with an impressive conversation to put the south Dublin outfit 26-6 ahead at the interval.
Desperate for a score, Garryowen came out with all guns blazing but were met with stern resistance from a stubborn home defence.
The visitors, however, were fortunate not to concede when Eoin Joyce was stopped just of the line as UCD's back-line continued to find holes in the Munster side's defence.
Garryowen were bossing possession but seemed to lack a cutting edge until some powerful forward play got them across the finish line.
Skipper Brosnan took the initative and drove over from a close range ruck with replacement Gaughan converting.
Buoyed by the try, the visitors continued to press and almost went over again before knocking on at the crucial moment.
UCD flanker Josh van der Flier thought he had scored from a breakaway, only for referee George Clancy to adjudge that the receiving pass went forward.
But in the last play of the game, Garryowen booted the ball upfield in and their gamble paid off as McInerney went over with Gaughan's extras giving his team some consolation.
Referee: George Clancy (IRFU)