Head coach Alan Solomons celebrated his first home match in charge of Edinburgh with a win thanks to a last-minute penalty from Harry Leonard.
The fly-half, making his first start, had knocked a drop-goal attempt off target moments earlier.
A Tim Visser try gave the hosts a 10-point lead early in the second half but former Edinburgh scrum-half Richie Rees replied with a sniping touchdown.
Kris Burton kicked the visitors level on 75 minutes before Leonard struck.
It was an error from Dragons replacement Burton that led to Leonard's match-winning moment, the Italy full-back kicking out on the full at the death to concede a scrum on the 22.
One last shunt from the beefy home pack resulted in an infringement and the 21-year-old kept a cool head to pop the ball between the posts from close range.
Solomons was able to restore wingers Visser and Nikki Walker to the Edinburgh XV after last weekend's defeat at Munster.
But there were very few attacking opportunities for the league's second and fourth all-time try-scorers in a tense, scrappy encounter.
However, Visser was on hand to score seven minutes after the interval, finishing off a great line break and offload from David Denton.
Leonard, who had landed two of his three penalties in the first half, then converted impressively from the touchline.
The Men of Gwent had won six of their last eight clashes with Edinburgh and arrived at Murrayfield buoyed by a 15-8 success against Ulster.
Jason Tovey kicked one from two penalties in a first-half and the Dragons fly-half converted Rees's clever score on 53 minutes.
The scrum-half, so often a disappointment in Edinburgh colours, nipped round the ruck to touch down after a penalty had been kicked to touch.
With both sides guilty of failing to execute basic passes and the game bogged down in midfield, it looked very much like the points would be shared when Burton's penalty sailed over after Denton was ruled offside following a tackle on another former Edinburgh man, Netani Talei.
The hosts had failed to take advantage of a yellow card for Lewis Evans late in the first half, with captain Ross Ford turning down three easy points in front of the posts only for Edinburgh to be penalised at the scrum in which they had a man advantage.
However, the late gift from Burton's errant clearance will ensure that mistake is not dwelled on.
And Leonard recovered his composure, having seen his hurried drop-goal bid from distance wobble wide, to make it a satisfying home bow for Solomons.
Edinburgh: Tonks, N. Walker, Fife, De Luca, T. Visser, Leonard, Kennedy, Dickinson, Ford, Nel, Gilchrist, van der Westhuizen, Basilaia, Grant, Denton, Cox.
Replacements: Hidalgo-Clyne for Kennedy (64), Blaauw for Dickinson (66), Cox for Basilaia (41), Watson for Cox (55). Not Used: Lutui, Cross, M. Tait, Cuthbert.
Newport Gwent D'gons: D. Evans, Pewther, Leach, Dixon, Amos, Tovey, Rees, O. Evans, Thomas, Way, A. Jones, Screech, L. Evans, Cudd, Talei.
Replacements: Burton for Tovey (65), J. Evans for Rees (65), Price for O. Evans (49), Faletau for Cudd (10). Not Used: Gustafson, Chaparro, Sidoli, Wardle.
Sin Bin: L. Evans (38).
Ref: Dudley Phillips (RFU).