Rovers had asked for the game to be postponed after they were unable to bring in cover with all three of their goalkeepers sidelined by injury.
But their request was rejected by the Scottish Professional Football League and they had to fulfil the fixture with an outfielder in goal.
Midfielder Ryan Stevenson volunteered to stand in for Conor Brennan, who sustained a foot injury in Saturday's defeat at Queen of the South, and for much of the contest the 32-year-old frustrated Ayr
Both sides went into the game in wretched form - Raith had not won in 14 league matches while Ayr were 11 without victory - and there was little to separate them in a tense encounter.
Ayr were unable to take advantage of Raith's handicap until Farid El Alagui headed in Brian Gilmour's cross on 62 minutes for his first goal since October.
And that proved to be the winner as ninth-placed Ayr moved to within a point of their fellow strugglers in Ladbrokes Scottish Championship.
Source : PA