Christy Fagan's late double kept St Patrick's Airtricity League Premier Division title aspirations on track with a 2-1 win over Bohemians.
Chasing a sublime early goal from Danny Joyce, St Pat's utterly dominated the game.
But they didn't level until the 82nd minute when substitute Dean Kelly's shot came back off the bar and Fagan tapped home.
Fagan then won it four minutes into added time at the death, getting on the end of a terrific cross from Sean O'Connor to head home from close range.
The win, only their sixth of the campaign, sees Liam Buckley's side regain second place ahead of champions Shamrock Rovers and edge to within four points of leaders Sligo Rovers.
It augured reasonably well in the early moments as the Saints had Bohemians on the back foot at Richmond Park as they opened up the visitors on several occasions.
Chris Forrester ran at the Gypsies' defence to shoot into the side netting before Greg Bolger's incisive pass put Fagan in behind only for the striker to fire over the top.
But very much against the run of play, Bohemians stole the lead in their first attack on 10 minutes.
Midfielder Joyce let fly with a curling right-footed shot which seemed to catch Brendan Clarke, who may have been hindered by the sun in his eyes, unawares to end up in the top corner.
Stung, the hosts surged back on the offensive with Bohemians keeper Craig Sexton bravely saving twice in quick succession at the feet of Bolger and then John Russell.
Darren Meenan then saw his intended cross deceive Sexton and come off the far post on 21 minutes with Kevin Feely putting the ball out for a corner.
Bohs were not slow about putting their foot in with both Forrester and Ger O'Brien needing treatment for heavy knocks as St Pat's, who were lacking a cutting edge up top to go with the possession, trooped off frustrated at the break.
The visitors introduced Dinny Corcoran and Stephen Traynor at half-time, as they switched to a conventional 4-4-2 formation.
But it didn't stem the tide of St Pat's attacks, as Sexton was worked twice early on by shots from Russell and Forrester.
In a rare foray forward, Bohemians came close to doubling their lead on 57 minutes. Corcoran's neat footwork set up Traynor whose fierce goalbound drive was bravely blocked by Kenny Browne.
The Saints continued to huff and puff at the other end. Their dominance was exemplified by a corner count of 12 to one. Russell headed to the net from O'Brien's sublime cross on 70 minutes only for an assistant's flag to be raised for an offside.
Fagan then came to the rescue.