Christopher McAuley, 35, admitted being concerned in the supply of the drugs at his home in Glasgow in September 2016.
Defence advocate Sarah Livingstone said the father of two had been holding the drugs for others and he had no idea of the value or purity.
At the High Court in Glasgow, he was remanded in custody pending sentence.
Prosecutor Keith O'Mahony said: "He was employed as a sales manager for the Arnold Clark motor group, but lost his job as a result of this case."
Police with a search warrant found two white blocks of powder, later forensically confirmed to be cocaine, on top of the fridge in the kitchen.
A further block, which contained heroin, was found in a shoebox in a wardrobe in a bedroom.
The blocks of cocaine were more than 60% pure and the heroin was 28% pure.
Mr O'Mahony said "If adulterated to street level purity of 16% and sold in one gram deals the cocaine had the potential to realise approximately £320,000."
The court was told the heroin would have the potential to realise £12,840.
Ms Livingstone said McAuley had a background of depression, gambling and debt.
A car salesman with debt and gambling problems was caught with cocaine and heroin with an estimated street value of £330,000, a court has heard.