Defender O'Donnell lashed home an emphatic strike after just 12 minutes but the Jags struggled to assert themselves against a side two divisions below them.
Boss Alan Archibald made six alterations to the side which kicked-off the new Scottish Premiership campaign against Dundee United on Friday night and the wholesale changes looked to have destabilised his team.
But Balatoni confirmed the win with a second in the 82nd minute before Mark Shankland caused nerves to flutter when he headed home for the visitors with a minute to go.
After a scrappy first 10 minutes, the game was quickly lit up by O'Donnell's stunning opener.
Ross Forbes crossed from the left for Christie Elliott on the edge of the box. With Ayr defender Martin Campbell rapidly closing him down, the Thistle striker knocked a square pass right for full-back O'Donnell to gallop onto before smashing it into the top corner.
But the visitors nearly found an immediate leveller as striker Michael Moffat's deflected strike bounced kindly for partner Craig Malcolm in the box but his lob over Scott Fox in the home goal hit the bar.
Mark Roberts' Honest Men suffered another blow when an injury saw Campbell limp off after just 21 minutes to be replaced by Josh McCarthur.
But from that point on, it was United who looked the more threatening in the final third.
Gordon Pope fired wide from 25 yards for Ayr while Aaron Taylor-Sinclair had to boot clear just as Moffat readied himself to nod home a ball bouncing across the Jags' goalmouth.
Accuracy in passing was a rarity in both sides' play but Moffat did superbly to conjure an opportunity of his own as he carved his way past three Partick players during a 20-yard slalom but his miscued finish never came close to troubling Fox.
The home side had to wait until the final 15 minutes before they could build any pressure, with defender Gabriel Piccolo heading off the bar while substitute Sean Welsh saw his own nodded effort cleared on the goal-line by Tony Marenghi.
The all-important second goal came with eight minutes left as Stevie Lawless worked himself into a crossing position on the right before picking out Balatoni at the near post to steer a header into the far corner of the net.
But after Shankland got to Michael Donald's cross before Fox to head into an empty net, the Ayr goalscorer passed up a glorious chance to take the game into extra-time to when he rolled a low shot onto the post 30 seconds later.