Ashley Sibery, 39, persuaded Sital Sibery to take the class A drug minutes after she confronted him about his drug habit in their home.
It happened on 2 April 2012 at their London Street property.
Sibery pleaded guilty to a charge of culpable and reckless conduct at Edinburgh Sheriff Court.
The court heard that when Mrs Sibery decided to confront her husband because of his erratic behaviour, the GP admitted he had been using the narcotic for two months.
She told him if he did not quit his addiction, she would end his marriage to him.
But despite the ultimatum, Sibery managed to persuade his wife into taking what was supposed to be his final fix.
The court heard how Sibery wanted his wife to experience the feeling he got when he took the heroin.
However, Mrs Sibery collapsed and started having difficulties breathing.
The court also heard that Sibery, who was on bail for the offence, was now in the care of a consultant psychiatrist who was helping him to tackle his problems, and that he and his wife were still together.
Sheriff Jarvie told Sibery that she would pass sentence on him at a hearing next month.
A drug-addicted doctor watched his wife lose consciousness and struggle for breath moments after injecting her with heroin in Edinburgh, a court has heard.