Kilmarnock were handed a boost ahead of the tie with the news that goalkeeper Alan Combe had ended speculation about his future by agreeing a new deal to remain at Rugby Park until 2011.
But, despite being available again after suspension, he missed out on the trip to Somerset Park with a neck injury, meaning Damian Rascle deputised between the sticks again.
Killie made two changes from last week's draw against Falkirk, with Danny Invincibile and Bryson drafted into the first team and Jamie Hamill and Gavin Skelton named on the bench.
Killie had forged ahead when Fernandez whipped the ball across the box from the right, Ayr keeper Stephen Grindlay got the faintest of touches and Manuel Pascali deflected home from close range. (right).
Keenan levelled after 14 minutes with a diving header past Rascle after Ryan Stevenson's left-wing cross was flicked on by David Gormley.
Ayr chould have taken a shock lead moments later when Scott Walker headed wide after Chris Aitken's free kick found him at the back post.
Grindlay in the home goal had to look smart to tip Grant Murray's cross from the right over the bar after the wind forced it towards goal on the half-hour mark.
The wet and windy conditions were making it difficult for both teams and the game settled down after a frenzied start.
Decent play from Gibson saw him beat two Ayr men but his cross was caught in the wind and landed harmlessly on the roof of the net.
Gormley missed a couple of good opportunities to hand Ayr the advantage after the restart, his first effort blocked by the goalkeeper and his second nodded wide of the upright.
The Clydesdale Bank Premier League side forged ahead after 54 minutes after good work by Gibson on the left saw the ball centred to Craig Bryson, who finished from just inside the area.
Ayr immediately tried to haul themselves back into the tie and Bryan Prunty was agonisingly close to meeting a Stevenson ball at the near post and poking home.
At the other end, Grindlay was called into action to pull off a superb double block, firstly denying Garry Hay's shot, before keeping out the rebound from Wright.
Jim Jefferies' side squandered an opportunity to move further ahead with 15 minutes remaining when defender Mark Campbell's rash tackle on Garry Hay led to a penalty for Kilmarnock.
Allan Russell's effort from the spot lacked precision and was saved by home keeper Grindlay to keep Ayr in the hunt.
It was a crucial intervention as, with second remaining, substitute Williams volleyed home from the edge of the box to force a replay on Tuesday 20 January after Rascle punched clear.
Sandy's Match Pic's are HERE