Edinburgh ground out a hard-fought victory over Dragons to climb to second place in Pro14 Conference B.
Blair Kinghorn scythed in for the opening try on 14 minutes with Simon Hickey adding the conversion and a penalty before half-time.
Another Hickey penalty put Edinburgh 13-0 up but Dragons struck back through Adam Warren's converted score.
A well-constructed Duhan van der Merwe try took the hosts two scores clear and kept the region fifth in Conference A.
Magnus Bradbury came close to adding a third Edinburgh try in the final five minutes but lost control of the ball under pressure as he drove over the whitewash.
Edinburgh will be thankful for the points, but the performance was substandard. The visitors scored a fine try but offered very little thereafter. This was no classic. Both sides were coming off the back of losses last week, Edinburgh going down away to Benetton and Dragons having the misfortune of being on the wrong end of a 50-pointer in Dublin.
With home advantage - two wins out of two so far at Murrayfield with 14 tries scored in those games - Edinburgh welcomed back some more international players, John Barclay and Ben Toolis starting with Jamie Ritchie and Grant Gilchrist on the bench. That freewheeling form deserted Edinburgh here, though.
They also had Kinghorn on the field from the start and it was the full-back who opened the scoring when Edinburgh attacked off a static maul. They swept left and as Dragons got their spacing wrong the full-back cut his way through to score. Hickey converted and gave the impression that Edinburgh were about to hit their stride. They weren't.
Much of the rest of it was humdrum. Sam Davies had two shots at goal and missed both of them, the latter effort slapping off the left-hand post. Mistakes destroyed momentum.
Edinburgh had a lot of the ball but precious little accuracy. At the end of the half they had five minutes of constant pressure in and around the Dragons five-metre line but couldn't do much with it.
Dragons gave away four penalties in those minutes and Edinburgh went for a line-out and scrums with each one. They tried to muscle their way through the visitors but the visitors weren't for being out-muscled. In the end, Edinburgh went for the posts after Brok Harris killed the ball. Hickey gave them a 10-0 lead at the break.
Toolis was sin-binned for a barge on Jordan Williams early in the new half, the second row being quickly followed to the sideline by Huw Taylor, who tested referee George Clancy's patience at the breakdown once too often. From that penalty, one of 15 given away by the Dragons, Hickey made it 13-0, but with Taylor still off the field, Dragons found a slick set-play off a scrum that put them back in the hunt.
A simple eight-nine move and Davies was in behind Mark Bennett, the fly-half finding Warren on his shoulder. The centre ran on to score on the night of his 100th appearance for his club. With the conversion it was a six-point game.
Edinburgh, one-paced and uninspired, needed to stir and they finally managed it just after the hour when they went through the phases, drew in the Dragons and then attacked them out wide. Hickey, Mike Willemse and Kinghorn all got their hands on it, Ritchie giving the try-scoring pass to Van der Merwe. The conversion was good and things looked a little prettier for the hosts at 20-7 at game's end.
Four lovely points on an otherwise ugly old night.
'We were 10% off' - reaction
Edinburgh head coach Richard Cockerill told BBC Scotland: "We've got to make sure when we get opportunities, we take them.
"We made some errors, we were a little bit unlucky at times. We were just 10% off across the board.
"We've got to make sure we don't get too downbeat because it's still a good win for us, but we certainly can play better.
Dragons try-scorer Adam Warren told BBC Wales: "After the last game (defeat in Leinster), it was a massive step forward, but it was disappointing because we felt we were in the game but for a few little moments.
"Dean Ryan's come in and he's got some good ideas, but he's still figuring out the squad although everyone's trying to go towards the same goal."
Edinburgh: Kinghorn; Sau, Bennett, Scott, Van der Merwe; Hickey, Pyrgos (capt); Shoeman, Willemse, Ceccarelli, Carmichael, Toolis, Barclay, Crosbie, Bradbury.
Replacements: Fenton, Sutherland, Berghan, Gilchrist, Ritchie, Shiel, Van der Walt, Taylor.
Dragons: J Williams; O Jenkins, Warren, Dixon, Hewitt; S Davies, R Williams (capt); Harris, Hibbard, Brown, J Davies, Screech, Keddie, Basham, Taylor.
Replacements: Shipp, Reynolds, Fairbrother, M Williams, Benjamin, Baldwin, Robson, Morgan.
Referee: George Clancy (IRFU)
Assistant referees: Ian Kenny (SRU), Graeme Ormiston (SRU)
TMO: Colin Stanley (IRFU)