However, it was the Honest Men who secured a top-four berth thanks to a 4-1 thrashing of East Fife, Craig Malcolm netting a hat-trick and Brian Gilmour also getting on the scoresheet. Liam Buchanan scored a late consolation for the Fifers, who finish the season in second-to-last place.
Meanwhile, Airdrieonians defeated Arbroath 2-0, a result that condemned the Lichties to automatic relegation to Scottish League Two. Caolan McAleer and Liam Coogans did the damage for the Diamonds.
Results in full: Airdrieonians 2-0 Arbroath, Ayr United 4-1 East Fife, Brechin City 1-3 Stenhousemuir, Dunfermline Athletic 1-1 Rangers, Stranraer 3-1 Forfar Athletic