BERWICK threw away a two-goal lead but recovered to sink the First Division new boys with a fantastic finale.
The Lanarkshire side dominated most of an entertaining game and should have had it wrapped up long before the Borderers' late revival.
The lively Darren Gribben fired Berwick in front after seven minutes and Jamie Ewart tapped in the second 11 minutes later.
But the Diamonds drew level before the interval thanks to a sizzler from Stephen McDougall in 27 minutes and a low strike from Paul Di Giacomo in 41 minutes.
Kevin Watt blasted Airdrie in front for the first time in 53 minutes.
But Rangers kept plugging away and David Grant headed the equaliser in 87 minutes then set up Fraser McLaren for the clincher 60 seconds later.