Hamilton Accies were forced to settle for a point after Kerr McInroy leveled four minutes into stoppage time.
Andy Winter’s early strike had Accies ahead, but McInroy struck deep into stoppage time to rescue a draw.
It was heading for a third successive Hamilton win, but that would have been harsh on a hard-working Ayr side who forced some great saves from Ryan Fulton.
Winter struck just six minutes into the game, cutting inside from the left before curling an upstoppable shot into the bottom right corner for his fourth goal of the season.
Hamilton dominated the first half and could have added to their lead through Andy Winter and David Moyo, with Ryan in particular forcing a terrific save from Aidan McAdams.
Ayr also had chances and nearly opened the scoring within seconds through Kerr McInroy, who went close later in the first half, with James Maxwell also looking lively for the Honest Men, while Sean McGinty forced a terrific save from Ryan Fulton.
The second half was played at much less frantic a pace, but Maxwell saw a hitch-kick superbly saved by Fulton, while Moyo went close at the other end.
Ayr United boss Lee Bullen made one change to the side that drew at Morton last weekend, with Daire O’Connor in for Alex Kenyon.
With Hamilton Accies head coach Stuart Taylor self-isolating, assistant John Rankin kept faith with the same side that started the last two games, and beat Queen of the South last time out.
Ayr created the first chance of the game inside the opening minute when Kerr McInroy’s fierce shot forced a good save from Fulton.
Accies had forced a series of corners but didn’t do anything with them.
However, they took the lead in six minutes when Winter picked up possession outside the box and curled a low shot into the bottom right corner.
David Moyo nearly doubled Hamilton’s lead shortly after that when he was sent through and beat keeper McAdams to the ball, but poked his low shot inches past the right post.
Accies were on form and nearly added to their lead in 12 minutes when Mihai Popescu’s cross from the right was headed just wide by Andy Ryan.
Ayr threatened again in 17 minutes when O’Connor broke down the left but his cross was sliced past the near post by James Maxwell.
Two minutes later O’Connor’s cross from the left was deflected past his own near post by Popescu.
McInroy’s corner from the right was met with a bullet header by Sean McGinty, but Fulton got down well to block at the near post.
Ryan let fly with a shot from distance in 29 minutes that McAdams did well to touch onto the bar and over.
Ayr nearly drew level in 30 minutes when O’Connor sent Maxwell through and his shot was well blocked by Fulton, before McInroy’s follow-up was blocked by Steve Lawson.
Hamilton went close to stretching their lead in 43 minutes when Kieran MacDonald’s corner from the right was headed by Popescu, but deflected over.
McInroy had a go three minutes into the second half, but felt his effort over from just outside the bar.
Maxwell went desperately close to grabbing an equalizer in 53 minutes with a dipping hitch-kick that Fulton did well to claw past.
Moyo had a shot deflected past for a corner on the right in 68 minutes, but MacDonald’s set-piece was cleared comfortably.
The Accies striker was nearly given a sniff in 89 minutes when Ayr were short with a pass-back, but McAdams cleared in time.
Sub Scott Martin had a go from distance in stoppage time, with rain lashing down onto a greasy surface, but McAdams caught it at the second attempt.
At the other end Pat Reading tried his luck with a drive, but felt it over the bar from the left corner of the box.
McInroy struck at the death to rescue a point.
AYR UNITED: McAdams, Houston, Muirhead, McGinty, Reading, O’Connor (Adeloye, 46), Murdoch, McInroy, Maxwell, Bryden, McKenzie (Moffat, 70).
Subs (not used): Albinson (GK), Baird, Smith, Kenyon, Hewitt, Fjortoft, Ecrepont.
Booked: Bryden (61), McGinty (61)
HAMILTON: Fulton, Hamilton, Popescu, Easton, O’Reilly, Spence, Lawson, MacDonald (Shiels, 78), Ryan, Winter (Martin, 64), Moyo.
Subs (not used): J. Smith (GK), L. Smith, Hughes, Mullin, Mimnaugh, Brown.
Booked: Moyo (61), O’Reilly (71), Lawson (76), Ryan (90+5)
Referee: Chris Graham.
Follow Lanarkshire Live Sport onTwitter via@LanLiveSport, like us onFacebookor find us onInstagramfor the latest sports news, pictures and video.