Head coach Graeme Patterson’s side remain third from bottom of the table but they’ve gone 17 points clear of basement side Berwick, beaten 56-3 away to Howe of Fife at the weekend.
The Pees are now on 18 points from nine fixtures, with winless Berwick on one from nine and second-from-bottom Kirkcaldy on 13 from eight.
The Borderers’ try-scorers in Inverleith were hooker Matt Carryer at the double and replacement Ru Smith.
Next up for them is a trip to second-placed Glasgow High Kelvinside this coming Saturday, with kick-off at 2pm, and they’ll go into that away-day looking to make amends for a 27-14 defeat in August’s reverse fixture at the Gytes.
Looking back over Saturday’s victory, Paterson told Borders Rugby TV: “Obviously we’re delighted we got the win and a last-gasp win at that.
“Fantastic spirit and effort was shown by our guys in the face of a bit of adversity, and to claw our way back into the game and get over the line was great.
“I thought we adjusted pretty well to the situation and we got our tactics right when they needed to be.
“It was pretty direct and that’s what undid the opposition. They just couldn’t cope with our momentum swing there.
“The guys just put everying out there and got the win, so I’m really pleased.
“It just shows what we can do if we apply ourselves.”

5. Stewart’s Melville v Peebles
Peebles winning 25-22 away to Stewart’s Melville in Edinburgh on Saturday (Photo: Erica Guiney) Photo: Erica Guiney

6. Stewart’s Melville v Peebles
Matt Carryer in action for Peebles during their 25-22 win away to Stewart’s Melville in Edinburgh on Saturday (Photo: Erica Guiney) Photo: Erica Guiney

7. Stewart’s Melville v Peebles
Peebles winning 25-22 away to Stewart’s Melville in Edinburgh on Saturday (Photo: Erica Guiney) Photo: Erica Guiney

8. Stewart’s Melville v Peebles
Peebles winning 25-22 away to Stewart’s Melville in Edinburgh on Saturday (Photo: Erica Guiney) Photo: Erica Guiney

