Ayr striker Michael Moffat's late winner clinched Ayr a 2-1 win in the second leg of their Irn-Bru First Division play-off final and condemned Brechin to another season in Division Two.
Moffat struck an 87th-minute winner as Ayr fought back from behind to secure a 3-2 aggregate win after the first leg had ended 1-1.
Brechin, beaten play-off finalists last season and ousted in the semi-finals the campaign before, had taken the lead a minute before half-time thanks to Ayr midfielder Jonathan Tiffoney's own goal.
But Ayr striker Mark Roberts struck a 77th-minute equaliser, his 24th goal of the season, and Moffat pounced late on to break Brechin hearts.
Tiffoney inadvertently put the ball into the bottom corner of his own net and beyond goalkeeper Alan Martin from 12 yards a minute before half-time.
But Moffat found his strike partner in the box 13 minutes from the end and Roberts fired home from six yards to haul Ayr level.
Roberts then turned provider for Moffat with the clock ticking down, the latter turning home the former's pass from the left into the bottom corner from 12 yards.