Saints survived an early scare when Williie McLaren's 18-yard flighted shot swerved inches wide.
The visitors stamped their authority on the game early on, controlling the action for almost the entire first half except for a few minutes before the interval by which time Saints were already a goal down.
Airdrie's opener came in the 21st minute when Neil McGowan's long-range free-kick was headed into the danger area by Martin Hardie. The ball was then crisply dispatched into the net by McLaren.
Stephen Dobbie almost snatched an equaliser in first-half injury time when his shot from Ryan McCann's smart lay-off bounced off the wrong side of the crossbar.
The second half belonged to Saints with Dobbie scoring his first goal in front of the home fans in the 58th minute.
Late on the match took a bizarre turn. A game which was never dirty saw two players being red-carded by referee Allen. Stephen Docherty was the first to be sent packing for bringing down Ryan Stevenson as he bore down on goal with five minutes to go.
The man in black evened things up by sending Stevenson to the dressing room for what looked like a harmless if mistimed tackle on substitute David Dunn in the 90th minute.
With the game already in injury time, it looked as though the sides were going to take a point apiece. But in the 93rd minute Airdrie striker Alan Gow took a pass from Dunn and broke downfield to claw an unlikely winner.