Goals from Karl Sheppard and Garry Buckley and an own goal earned Cork City a Premier Division record tenth win from ten as John Caulfield's side stayed nine points clear at the top.
All three goals came in the final half-hour of an evenly-contested game of relatively few chances, although City can point to hitting the woodwork twice as proof of their greater edge in attack.
City boss John Caulfield made just the one enforced changed as he again opted not to tinker with the winning side that made it nine from nine with a 2-0 win over Bohemians last week.
That meant a spot on the bench for Greg Bolger as he returned to the club with whom he won a league title in 2013 as Steven Beattie came in for injured right-back Jimmy Keohane.
Saints' Kurtis Byrne was the architect of the game's first chance as fed full-back Ian Bermingham, who cut back towards O'Hanlon on the penalty spot only for City captain Alan Bennett to intercept.
City had to wait until ten minutes from the break for their first real sight of goal as Stephen Dooley played in Garry Buckley, but his shot from a tight angle was straight at Conor O'Malley.
Defender Ryan Delaney, on loan from Burton Albion in England, hit the post from a Dooley corner shortly after before putting the rebound wide.
Pats' best chance arrived a minute before half time as Kurtis Byrne's free kick was headed across the box by Gavin Peers and Rory Feely stooped to head, but without enough power to trouble McNulty.
Then came the sequence of events that led to the goal as Kurtis Byrne caught Conor McCormack with a trailing leg in the air and, in the melee that followed, Buckley and Gavin Peers were booked.
Kevin O'Connor swung in the subsequent free kick, which took a deflection and squirmed in the bottom corner of Conor O'Malley's net. It seemed to go in off a Saints defender, but Delaney was credited with the goal.
City had a chance to make it two soon after as they broke in numbers and Maguire was clipped on the edge of the box by Bermingham.
Contact appeared to take place inside the box, but a free kick right on the edge was awarded. O'Connor almost rendered the distinction immaterial as he smashed the ball off the post.
Pats introduced former City winger Billy Dennehy as they sought to force their way back in and he nearly equalised with a free kick McNulty did brilliantly to tip out of the top corner.
It wasn't long before City wrapped up the points as Maguire set up Sheppard who blasted the ball past O'Malley, who got a hand to the ball and should have kept it out.
Buckley put the icing on top with a sublime finish in the fourth minute of injury time as he lifted the ball over O'Malley from substitute Shane Griffin's pass.
St Patrick's Athletic: Conor O'Malley; Michael Barker, Gavin Peers, Rory Feely, Ian Bermingham; Lee Desmond (Graham Kelly 84), Darragh Markey (JJ Lunney 84), Sam Verdon, Conan Byrne, Kurtis Byrne (Billy Dennehy 78); Josh O'Hanlon.
Cork City: Mark McNulty; Steven Beattie, Alan Bennett (John Dunleavy 51), Ryan Delaney, Kevin O'Connor; Conor McCormack (Greg Bolger 66), Garry Buckley, Gearóid Morrissey; Karl
Sheppard, Stephen Dooley (Shane Griffin 84), Sean Maguire.
Referee: Robert Hennessey (Limerick).