Lee Connors pointed a handgun at Grant MacBeth’s face and tried to discharge the weapon before fleeing from the scene in Wester Hailes.
When police later recovered the revolver they found that there were three bullets in the six chambers of the gun.
Kimberley Dow, who also had the gun pointed at her by Connors, told a court: “He pulled the trigger three times at Grant..I can still hear the clicking in my head today.”
Connors, 30, also known as Hunter, had denied attempting to murder Mr MacBeth on October 25 in 2014 at Barn Park, but was found guilty after trial.
Connors was also convicted of a breach of the peace and firearms offences, including illegal possession of the gun and ammunition.
Judge Lord Uist told him: “You have been convicted by the jury of very grave crimes. It is likely you will receive a very long prison sentence for these crimes.”
Ms Dow said that before the murder bid Connors had contacted her and said he needed help and could not ask anyone else.
They went to her flat in Barn Park where she saw the gun for the first time. “Lee had it in his hand. I was like ‘You can’t have it in here’.”
She said Connors did not stay at her home that night. Mr MacBeth had come to her home the following day but Connors appeared at the window and was “out his face”.
She said he was “foaming, raging”. “He really wasn’t very happy when he saw Grant,” she said.
Connors drove off but returned screeching round the corner as she went towards Mr MacBeth’s car.
She said: “He had the gun pointed at me when he was coming round the corner. He then pointed the weapon at Mr MacBeth who told him ‘do what you have got to do’, she said.
She said: “He pulled the trigger three times at Grant.”
Advocate depute Craig Murray asked her how she knew that and she replied: “Because I heard the clicks. Click, click, click.”
Sentence was deferred on Connors until next month.