Robbie Benson scored a stoppage time penalty winner in a frenetic finish to the Dublin derby at Richmond Park as Bohemians thought they had salvaged a draw just minutes earlier from a spot kick goal of their own.
The woodwork had twice thwarted Bohemians before St Pat's stole the lead through Mattie Smith on 74 minutes.
Dawson Devoy equalised right on 90 minutes from the visitors’ second penalty of the game before Benson got St Pat’s back to winning ways after two defeats, stroking home from 12 yards to leave the final score at 2-1.
Unchanged for the third match running, St Pat's enjoyed plenty of the ball early on before their ire was raised by the game's first talking point nine minutes in when Ian Bermingham, part of the home side’s defensive wall, was harshly adjudged to have handled an Ali Coote free kick.
Referee Rob Hennessy pointed to the spot and showed a yellow card to the St Pat’s captain much to the consternation of the home players and their bench.
St Pat’s will feel poetic justice was duly served when Georgie Kelly crashed his spot kick off the crossbar.
In a tight game, James Talbot produced the first save of the evening just past the half hour, parrying away a stinging drive from Pat’s defender Sam Bone who had nicked the ball off a sluggish Ross Tierney in midfield.
Owning the ball for a period after the restart, Bohemians pressed St Pat’s well, forcing a real chance on 53 minutes.
A loose pass from Bone was pounced on by the lively Liam Burt who skipped past John Mountney and Bone in turn to work Vitezslav Jaros into pushing his shot from a tight angle out for a corner.
The frame of their goal rescued St Pat’s for a second time on 69 minutes; Tyreke Wilson curling his free kick up and over the wall only to see it cannon back off the crossbar.
A minute later Georgie Kelly might have done better than direct his free header straight at Jaros from Wilson’s cross.
The course of the game looked to have changed on 74 minutes as St Pat’s stole the lead against the run of play.
Bone won a defensive header to find substitute Benson just inside the visitors’ half.
A perfectly weighted pass put Smith in down the inside right channel and the striker drilled his low shot beyond Talbot and into the far corner.
But a second controversial penalty decision right on 90 minutes looked to have provided Bohemians with a deserved draw, John Mountney pulling down Burt, although the foul looked outside the area.
Devoy confidently sent Jaros the wrong way from the spot as St Pat’s head coach Stephen O’Donnell was sent to the stand for dissent.
The drama wasn't over, though, as two minutes into added time Bohemians’ defender Ciaran Kelly barged Benson to the ground inside the area at the other end.
Benson drove his penalty straight down the middle to get St Pat’s back on track and end Bohemians' recent revival.
St Patrick’s Athletic: Vitezslav Jaros; John Mountney, Sam Bone, Lee Desmond, Ian Bermingham; Jamie Lennon, Alfie Lewis; Billy King (Paddy Barrett 84), Chris Forrester (Robbie Benson 55), Mattie Smith; Ronan Coughlan (Ben McCormack 74).
Bohemians: James Talbot; Rory Feely, Rob Cornwall (Andy Lyons 90+1), Ciaran Kelly, Tyreke Wilson; Keith Buckley, Dawson Devoy; Ali Coote (Robbie Mahon 86), Ross Tierney, Liam Burt; Georgie Kelly (Promise Omochere 86).
Referee: Rob Hennessy (Clare).