Two late penalties by substitute Lee Jarvis kept the Dragons in the hunt at the top of the Celtic League.
Edinburgh: (6) 14
Pens: Laney 3
Dragons: (13) 19
Pens: Montgomery 2, Jarvis 2
Brendan Laney's long-range strike had until then looked enough to give hosts Edinburgh victory.
A Peter Sidoli try and kicks by Percy Montgomery had Dragons 13-6 ahead only for Simon Webster to touch down and Laney to land his third penalty.
But Jarvis came on to seal victory as Edinburgh suffered a blow to their hopes of moving out of the bottom half.
Edinburgh lie third bottom and need to stay ahead of Glasgow, who trail by 10 points, to retain their status as Scotland's top seeds in the Heineken Cup next season.
Third-top Dragons were under pressure from the start at Meadowbank, but Laney missed an early penalty and Webster squandered a chance of a try.
The visitors from Gwent made them pay for that after 17 minutes, Montgomery edging the Welsh ahead with a penalty after a Webster defensive slip.
Sidoli claimed the first try in the wake of a breakdown in communications at the back involving the unfortunate Webster and Hugo Southwell.
Montgomery added the goal from the touchline before trading penalties with Laney, who slotted another just before the break from 35 metres to narrow the gap to seven points.
Todd Blackadder returned from injury for Edinburgh
Irish World Cup referee Alan Lewis was forced to quit the action with a leg problem just after the restart and was replaced by Ian Heard of Biggar.
Edinburgh were in command and Allan Jacobsen did the initial damage for their try before Laney gave winger Webster time and space with a long, looping pass.
Laney the saw a long-range penalty shave the wrong side of the post, but two minutes later found his range and direction to put Edinburgh in front.
However, Jarvis came off the bench to clinch the game as Edinburgh paid the price for poor discipline.
Edinburgh: Lee, Webster, Di Rollo, Dickson, Southwell, Laney, Blair, Jacobson, Kelly, Brannigan, Hines, Murray, Blackadder, Cross, A. Dall.
Replacements: Di Ciacca, Smith, Kellock, Strokosch, Lawson, Warnock, Joiner.
Dragons: Tuipuluto, Brew, Montgomery, Winn, Luscombe, Warlow, Baber, Black, S. Jones, Thomas, Gough, Sidoli, Beattie, Forster, Skinstad.
Replacements: Crawford, Snow, Owen, Ringer, R. Jones, Jarvis, Breeze.
Referee: A Lewis (IRFU)