Tries from Ben Breeze and Gareth Cooper saw The Dragons extend their winning run to five games and move into second place in the Celtic League.
Borders (3) 6
Dragons (7) 14
Tries: Breeze, Cooper
Cons: Sweeney 2
The home side, without a win this season, had the bulk of pressure but could only manage a drop goal from Ally Warnock and a Charlie Hore penalty.
Hore missed two penalties, while Nikki Walker and Stephen Cranston were denied good try-scoring opportunities.
The impressive Ceri Sweeney converted both of the visitors' tries.
Borders were given early encouragement when Warnock slotted a confident drop goal after just two minutes.
However, the Scots were punished for some sloppy handling soon after as winger Breeze raced over in the corner to put the Welsh side ahead and Sweeney made light work of an awkward conversion angle.
The spirited home side continued to play above their lowly league position in the keenly contested forward exchanges and they might have reduced the leeway when Warnock pulled another drop goal attempt off target.
Borders' lack of the killer instinct was in evidence again when first Walker was held up on the line and then a wild pass denied Cranston what looked like a certain try after the ball had been recycled.
The Dragons went close when Sweeney kicked to the corner and Jonny Weston just beat Welsh winger Gareth Wyatt to the touchdown.
However, Borders continued to enjoy the better of the exchanges on the restart without being able to find the cutting edge.
Their frustrations continued after 53 minutes when Hore sent a 40 metre penalty wide of the posts.
Hore then set up a grandstand finish when he got a similar effort on target 10 minutes from time to reduce the deficit to one point.
But when the New Zealander missed again a minute from time, it was clear it was not going to be the Borders' night.
And Cooper delivered the knockout blow with a try, converted by Sweeney, in the fifth minute of injury time.
"It was a very ugly win but we'll take the points," said Dragons coach Chris Anderson.
Borders: Moffat, Walker, MacRae, Hore, Cranston, Warnock, Weston, Thomson, Ford, Douglas, MacLeod, Blair, Gray, Brown, Millar.
Replacements: Scott, Parr, Cross, Stewart, Rennick, Moore, Morton.
Dragons: Morgan, Wyatt., Montgomery, Tuipulotu, Breeze, Sweeney, Cooper, Black, Jones, Thomas, Gough, Sidoli, Ringer, Bryan, Forster.
Replacements: Richards, Snow, Anthony, Charteris, Beattie, Luscombe, Baber.
Referee: George Clancy (Ireland)