Charlie Hore and Chris Cuister were the heroes for Borders as they upset the Celtic League title hopes of Edinburgh.
Borders (9) 23
Pens: Hore 6
Edinburgh (6) 11
Pens: Paterson 2
Hore won his personal penalty kicking battle with rival Chris Paterson with one of his most important kicks giving Borders the lead just before half-time.
Cusiter scored a vital try when he won a straight race for the ball with Mike Blair to put Borders too far ahead for Edinburgh to catch.
Ally Kellock snatched a late try for Edinburgh but the home side held on.
The born-again Borders completed a three-in-a-row sequence to move into the top five, while Edinburgh were knocked off top spot by Ulster, who beat Connacht.
The opening exchanges were frantic and disjointed with both sides making a number of unforced errors.
And the scrappiness of play was underlined when the sides shared three penalty goals in the first eight minutes, Paterson's double for Edinburgh coming either side of Hore's longer range effort.
Reivers squandered two good try-scoring opportunities before they forced the Gunners to concede a defensive penalty close to the posts, giving Hore a formality of a kick to level.
In the dying seconds of the half Hore thumped over his third counter from 45 metres to edge Borders in front for the first time.
The penalty count against the visitors grew and Hore slotted two more goals in quickfire order to open up a nine-point gap.
Even better was to come for Borders when they carved out the all-important first touchdown - and it was a personal triumph for Lions scrum-half Cusiter as he won the race for the ball with Scotland Test rival Blair.
The rattled Gunners upped the ante in a bid to turn the tide, but a combination of robust defence and panicky mistakes ensured that the Reivers held out with comfort for one of the best results in their troubled history.
Kellock snatched a late try for Edinburgh, but it was scant consolation.
Border Reivers: S Moffat, S Danielli, B MacDougall, G Law, N Walker, C Hore, C Cusiter, P Thomson (capt), R Ford, T McGee, O Palepoi, C Stewart, K Brown, S Sititi, W McEntee.
Replacements: S Scott, G Cross, J Dalziel, A Rennick, B McKerchar, S Gray, C MacRae.
Edinburgh Gunners: H Southwell, C Paterson (capt), M Di Rollo, R Dewey, F Leonelli, P Godman, M Blair, A Jacobsen, D Hall, C Smith, F Pringle, S Murray, M Mustchin, S Taylor, S Cross.
Replacements: A Kelly, D Hewett, A Kellock, A Hogg, R Lawson, D Hodge, S Webster.