The hosts had arguably the better of the opening 79 minutes at McDiarmid Park before the game burst into life when Hibs conceded a penalty, which substitute Nigel Hasselbaink saw saved by goalkeeper Ben Williams.
Saints boss Steve Lomas was sent to the stand by referee Craig Thomson soon afterward and Cairney added to his misery by netting what proved to be the winner after 82 minutes.
Substitute David Robertson was taken off on a stretcher and Saints captain Dave Mackay was shown a straight red card for an altercation with Leigh Griffiths in stoppage time as the hosts’ misery was complete.
The victory came as welcome relief for Hibs, who returned to second ahead of Inverness, following successive losses to Dundee and Aberdeen and ahead of the Edinburgh derby with Hearts in the William Hill Scottish Cup fourth round on Sunday, while Saints saw their unbeaten three-match run end.
Saints enjoyed more possession early on, but struggled to test Hibs. Rowan Vine shot weakly at Williams before David Wotherspoon attempted to spark proceedings with a neat one-two with Griffiths, only for the return pass to bounce off his knee.
Mackay’s free-kick deflected over before Gregory Tade barged by Ryan McGivern and Stevenson on the right and crossed low for Steven MacLean, whose effort was blocked by Alan Maybury.
Paul Hanlon saw yellow for a late trip on Tade, presenting the hosts with another free-kick chance. Liam Craig hit it left-footed from 25 yards and it took a slight deflection before bouncing back off the crossbar.
Saints resumed on the attack, with Tade to the fore once more. A weak McGivern header ran into the path of the striker, who sliced off target.
Vine had a shot blocked by Hanlon before Saints had a fine chance. Craig, on the left, found MacLean, who evaded Stevenson’s lunge to shoot low, but too close to the goalkeeper as Williams saved.
With 11 minutes to go, Saints won a penalty. Williams scrambled the ball away from the feet of MacLean, but Hibs failed to clear and as Mackay moved into the box he was tripped by Wotherspoon. The Hibs goalkeeper saved Hasselbaink’s resulting spot-kick and the follow-up from Craig before Lomas’ frustrations boiled over and he was dismissed from the touchline.
Moments later, Saints went behind as the ball broke for Cairney in the centre of the area and he was able to prod in beyond Alan Mannus.
Robertson departed on a stretcher following a tackle in midfield and there was a dispute between Mackay and Griffiths, whom the Saints captain felt had chased down the ball which had been returned to the hosts.
Mackay was shown a red card as the frenzied finale finished on a sour note for Saints.