St Patrick's Athletic registered their first league win of the season as they overcame UCD 3-2 in their dramatic SSE Airtricity League Premier Division encounter at Richmond Park.
The game appeared destined for a draw but Christy Fagan pounced for the second successive week to seize the three points for the Saints in the 92nd minute. .
The league holders opened the scoring in the 25th minute through Conan Byrne but a double strike from Chris Mulhall ensured the students enjoyed a surprise 2-1 interval advantage.
After a sloppy opening period, the hosts were the first to threaten in the 5th minute as Christy Fagan jinked his way to the end line, but his subsequent delivery was comfortably repelled by Conor O'Donnell at his near post.
At the opposite end, Greg Bolger was harshly judged to have handled 22 yards from goal but Chris Mulhall failed to take advantage of the promising position as he curled his effort wide of Brendan Clarke's right-hand upright.
The momentum was with the Saints however, and after Byrne had his first-time shot blocked, Keith Fahey was also denied in the 13th minute following a trademark raid down the left wing from Ian Bermingham.
The contest meandered slightly for the ensuing six minutes, although a composed UCD highlighted their threat when Michael Barker's speculative effort from 30 yards had Clarke scrambling as the ball veered a yard wide.
Despite their comfort, UCD were undermined as Byrne raced onto Bolger's lengthy through ball in the 25th minute to poke a composed finish beyond O'Donnell from 12 yards.
Byrne could have added to his tally soon after, but shot wildly when well-placed 14 yards from goal, and he was left to rue that error when the Students levelled matters seven minutes before the break.
The move originated down the UCD right flank. Cillian Morrison was afforded far too much space to pick out an unmarked Mulhall, who rolled a calm finish across Clarke from 12 yards.
Further defensive uncertainty led to the champions falling behind in the 42nd minute as Ken Oman needlessly hauled down Mark Langtry, with Mulhall exacting full retribution with a 25-yard free-kick that Clarke allowed to sneak under his body.
The expected onslaught from the champions failed to materialise in the early stages of the second-half although Ian Ryan had to time his challenge to perfection when blocking Fahey's toe-poke from six yards.
That proved Fahey's last involvement as he limped off to be replaced by James Chambers in the 57th minute, but the mood of despondency soon lifted from Inchicore as Byrne doubled his tally seven minutes later.
The goal's origin stemmed from a needless foul by Robbie Creevy on Christopher Forrester and from 30 yards, Byrne curled a sublime shot over the wall and into O'Donnell's right-hand corner.
Far from building on that goal, St Pat's struggled for creativity from that juncture with a hint of desperation entering their play.
They were indebted to Clarke in the 69th minute, with the goalkeeper producing a stunning double save to deny both Gareth Matthews and Dean Clarke in quick succession on one of UCD's rare sorties into their opponents' half.
The game appeared destined for a draw but Fagan popped up in the second-minute of injury time to thump a powerful drive across O'Donnell from ten yards for the game's defining moment.