Goals from Graham Hay, Jonny Brown and Alan Trouten were cancelled out by Jon Daly, Bilel Mohsni and Nicky Law.
The decisive goal came from Nicky Clark as Rangers claimed nine league wins in a row at the venue where they played their first match post liquidation in July 2012.
Lee Wallace failed to recover from the knee knock that forced him out of the Scotland squad, paving the way for Steven Smith to start.
Robbie Crawford was also added to the Rangers side in place of Arnold Peralta, who was not named in the squad after extensive travelling on international duty with Honduras.
Rangers were seeking a positive result at the end of what had been another tumultuous week off the park, with chief executive Craig Mather's resignation just the latest twist in a bitter boardroom battle.
However, the Light Blues endured the worst possible start to the match when they found themselves trailing after five minutes.
Trouten delivered a corner into the box where skipper Hay was waiting unmarked to send a header past Cammy Bell.
Andy Ryan then saw a shot fizz across goal and wide of target as City aimed for a second goal.
They did not have too long to wait and doubled their advantage with eight minutes on the clock.
Brown stepped up for a free-kick on the edge of the area and the Rangers wall was powerless to prevent his effort from finding the back of the net.
Rangers could have pulled a goal back when Lewis Macleod's cross was met by a diving header from Andy Little from close range that fell just past the post.
The visitors did manage to haul themselves back into the game after 26 minutes when Daly raced onto a long ball before coolly slotting past Graeme Smith.
Rangers should have been back on level terms when an Ian Black free-kick into the box was fumbled by Smith and fell kindly for Lee McCulloch who rifled wide from six yards.
Instead, it was Brechin who were celebrating again after 35 minutes.
Law was unable to clear a poor Richard Foster pass, allowing Trouten to pounce and drill home from the edge of the area.
Unsurprisingly, Rangers made their first change at the interval, with Clark thrown into the action for Crawford.
The Glasgow giants did look more dangerous after the restart and Law embarked on a surging run down the right flank before teeing up the shot for Daly, who failed to hit the target.
Macleod then saw his ball into the box flicked on by Foster for Little but the Northern Irishman was denied by Smith.
But the Brechin goalkeeper was plucking the ball out of the net after 55 minutes when Mohsni poked home a Black free-kick from a couple of yards out.
Rangers were back on level terms 10 minutes later when what appeared to be a cross, rather than a shot, from Law managed to evade the goalkeeper and ended up in the back of the net.
Substitute Bobby Barr could have restored Brechin's lead but he hooked wide with the net at his mercy.
Craig Molloy then rattled the crossbar with a header as City pushed for the winner.
But the points went to Rangers with six minutes to go when David Templeton's cross found Clark who left Smith no chance with the header.
There was further misery for City when Trouten was dismissed at the end for a pull on Templeton on a day when referee Craig Charleston also brandished 11 yellow cards.