O'Connor fired Hibs back in front towards the end of an open and entertaining first half and took his tally for the season to 10 when he netted a disputed second-half penalty.
The dangerous Ivan Sproule had opened the scoring with an emphatic finish in the 17th minute but Liam Craig soon volleyed an equaliser.
Cillian Sheridan pulled a late goal back to ensure a fitting finale to a thrilling encounter but Hibs held on.
Colin Calderwood's men are now undefeated in five games since losing the Edinburgh derby last month and they ended St Johnstone's unbeaten away record with the help of a more solid second-half performance.
Both sides were handed pre-match fitness boosts for a fixture originally postponed to accommodate the home team's friendly against Sunderland.
St Johnstone skipper Jody Morris returned following a hamstring injury to replace Willie Gibson in the only change to the team that beat Hearts on Sunday.
Hibernian striker Leigh Griffiths shook off a foot knock to keep his place while Sproule came in for David Wotherspoon.
Hibs forced the first chance in the 10th minute when the ball broke kindly for Junior Agogo following a long throw, but Peter Enckelman pushed over the striker's volley from 12 yards.
Sproule finished off an excellent move in style to give Hibs the lead.
Agogo made room for himself with some ball juggling skills and received the ball back from O'Connor's backheel just outside the box.
The striker thought about shooting but elected to play the ball into the path of Sproule outside him.
The Northern Irishman appeared to have lost the chance after taking a touch but he thumped the ball into the roof of the net from 12 yards with his left foot.
The goal was the first St Johnstone had conceded away from home this season but they were level two minutes later.
Dave Mackay worked room on the right to cross and Craig got in front of Richie Towell to volley into the corner from the penalty spot.
The visitors came close to taking the lead when Kevin Moon's touch handed Chris Millar space in the box but his driven cross flashed just behind Moon with the goal gaping.
Saints should have gone ahead on the half-hour mark after Agogo lost the ball to Morris inside his own half as Hibs tried to play the ball out from the back.
Morris fed Francisco Sandaza, who turned Sean O'Hanlon one way and another but slipped the ball inches wide of the far post with his left foot.
Sproule's pace took him past Mackay and into a great position at the other end following Isaiah Osbourne's pass but he elected to cross when he had little support and had a reasonable angle to shoot.
Hibs were soon back in front as O'Connor continued his hot goalscoring streak in the 37th minute.
The forward was outnumbered in the box as Agogo helped on a long ball but it broke invitingly for him and he shot powerfully low into the net from 16 yards.
The visitors pushed for an equaliser before the break. Stack came off his line to block from Sandaza following Sheridan's through-ball and then got down well to push past Craig's powerful 25-yard drive.
O'Connor soon went close again with another left-footed drive from inside the box but Enckelman parried.
Saints had some decent pressure early in the second half but Hibs, with Martin Scott on for Griffiths, were sitting deeper to protect Stack and Sproule created a chance on the break but Agogo could not direct his header.
Hibs could not stop Millar shooting from 22 yards after a long period of Saints possession but the ball flashed just wide.
The hosts went further ahead in the 62nd in controversial circumstances.
O'Connor appeared to run into David McCracken and dive over his foot after losing the ball but referee Steve Conroy pointed to the spot and the striker sent Enckelman the wrong way.
Stack pushed away Sandaza's strike as the visitors sought an instant response.
Stack easily saved Craig's free-kick and Hibs appeared to be seeing the game out comfortably until Sheridan netted with two minutes left.
The Irishman brushed off centre-back Ian Murray as they chased a long ball and turned to curl the ball in off the post.
Panic spread throughout the home stands at Easter Road as the fans feared a repeat of Saturday's 3-3 draw with Dundee United but the visitors' chances ended when Craig's injury-time free-kick was cleared.