Serco employee John Baxter was trying to fix broken house arrest equipment when Iain Turnbull, 49, held the plastic pistol to his head.
Turnbull claimed Mr Baxter had been to his house so many times to check his tag detector that he considered him a friend and pulled the gun as a joke.
Advertisement
Hide AdAdvertisement
Hide AdAlthough Mr Baxter carried on with his work before leaving, police were called in after he told his boss about the incident.
A sheriff yesterday told Turnbull he had been "monumentally stupid".
Turnbull had been released early from prison for public order offences and had 14 days left on licence with the tag.
Defence agent Chris Fehily said: "This was an act of breathtaking stupidity. He had grown to know Mr Baxter fairly well and considered him as something of a friend. But it was a joke of remarkably poor taste."