The tussle was switched their neighbouring ground after Mansfield Park was flooded - and for a large portion of the match, the Greens looked like being swamped as well.
But a haul of five penalties by Craig Neish salvaged the crucial win.
He also goaled their only try in injury time by Barry Sutherland to make sure.
Damien Kelly scored Ayr's other try, with James Noonan converting both.
A try double from Ewen Campbell paved the way for Aberdeen GSFP's 20-29 victory over struggling Stirling County at Bridgehaugh.
The other Dons' touchdowns were snapped up by Gavin Strang and Mark Ozich, whose last-minute effort captured a bonus point. Keith Oddie added three conversions and a slick drop-goal.
County's retort was a brace of tries for Glasgow's apprentice flanker John Barclay, both goaled by Brian Archibald, who also stroked over two penalties. Glasgow's Dan Turner made his first appearance for County.
BT Premiership pacesetters Glasgow Hawks took another stride towards a third successive title by sweeping aside the challenge of Biggar with a 30-20 win at Hartreemill.
The visitors took full advantage when the home side were reduced to 14 men, totting up three quickfire touchdowns.
Their counters came from Warriors apprentice Iain Kennedy, Richie McKnight, Matt Smith, Sandy Warnock and Stevie Duffy to ensure the bonus point. Warriors' Graydon Staniforth made an appearance as a substitute after 44 minutes.
Mike Adamson banged over the rest with the boot. Chad Slade and Mike Erskine went over for Biggar, while Quintin Sanft struck two conversions and two penalties in vain.
Busy referee Peter Allan wielded four yellow cards to Richard Woods and Fraser Campbell of Biggar, along with Neil McKenzie and Mark Sitch from Hawks.
BT Scotland Premiership Division One
Biggar (13) 20 - Glasgow Hawks (22) 30
Boroughmuir (5) 22 - Watsonians (0) 22
Currie (12) 25 - Heriot's (21) 31
Hawick (9) 22 - Ayr (14) 14
Stewart's Melville FP (13) 44 - Melrose (3) 17
Stirling County (3) 20 - Aberdeen GSFP (10) 29