A stoppage-time winner from Jay Stein clinched a 3-2 win for Montrose and shattered Elgin's hopes of a play-off place.
Montrose were the better side in the opening period and took the lead after 11 minutes when Paul Stewart crossed for John Baird to score.
Craig Campbell hit the crossbar for Elgin and they grabbed an equaliser three minutes before half-time when Steven MacKay fired home a free-kick from 20 yards.
Elgin hit the post again through Mark Nicolson but it was Montrose who went back in front when Baird scored from the spot in the 67th minute.
The visitors thought they had earned a point when substitute Paul Kaczan expertly fired home an 89th-minute equaliser.
But Montrose went back on the attack and in time added on, Stein scored with a first-time volley.