Michael Rennie was overheard moaning about his money worries in a pub - and that led to an offer to make some cash, the High Court in Edinburgh heard.
But undercover police, trying to catch bigger fish, had started an under-cover surveillance operation - and Rennie, 28, was caught in the net, along with cocaine with a street value of more than £70,000.
In court, Rennie, of Oxgangs Place, Edinburgh, admitted being concerned in the supply of the drug in June and July last year.
Jailing him, judge Lord Turnbull told Rennie he had been part of a sophisticated criminal enterprise to supply drugs which would damage individuals, families and society in general.
“You chose to become involved in that trade with your eyes open and must now take the consequences,” he said.
Advocate depute Andrew Brown QC, prosecuting, said police found cocaine when they stopped Rennie’s car. There was more in a safe at his home.
They also seized a hydraulic press - with Rennie’s fingerprints on it - at a safe house which could have been used as a “chopping shop” for bulking out cocaine.
Mr Brown told how police on mobile patrol on the A701 south of Edinburgh last July 12 received a tip off and stopped Rennie’s Vauxhall Vectra.
A search at Rennie’s home recovered £400 in cash along with more than a kilo of the bulking agent benzocaine. High purity cocaine which could have been cut to produce about a kilo for street sales was found in a safe along with scales and a roll of bags.
Police were also told that Rennie had access to another flat, said Mr Brown. They forced entry to the unoccupied property in Oxgangs Road North and found the press used to produce blocks of drugs.
Solicitor advocate Robbie Burnett, defending, described Rennie as a hard-working family man.
Lord Turnbull expressed surprise that someone in the drug trade would entrust a valuable consignment of cocaine to a stranger.
Mr Burnett told him: “I can find nothing at all to contradict his assertion that his life, up to then, had been completely free of drugs - from any form of drug abuse and from any involvement in the supply of drugs.”
He said business had been difficult and self-employed Rennie was under enormous financial pressure. He yielded to the temptation offered to him.