A Tayside patient waited two-and-a-half years for treatment – breaching Nicola Sturgeon’s flagship health target by more than 800 days.
The Dundee-based health board recorded the longest wait in the country at 896 days under the treatment time guarantee.
NHS Fife had the fourth worst delay at 403 days, with both of those waits recorded in 2017-18.
Another patient in Tayside is still waiting for treatment after 849 days, according to health board data published on Friday.
The Scottish Liberal Democrats, who obtained the figures, said the scale of the breaches is “shocking”.
The 12-week TTG became a legally-binding promise to patients when Ms Sturgeon introduced it as Health Secretary in the Patients Rights (Scotland) Act 2011.
It covers planned procedures undertaken on an inpatient or day case basis, pledging that people would receive their care within 84 days of it being agreed with health professionals.
As of the end of September 2018, there were 2,667 Tayside patients waiting longer than 84 days for an inpatient or day case procedure.
A spokeswoman for NHS Tayside said long waits are rare and can relate to postponements to make way for emergency procedures and individuals not being well enough for treatment.
“In the cases where patients are deemed unfit, it may be that further clinical investigations need to be completed before the patient can have their surgery and, even during this time when patients are unavailable, they are still counted in our waiting times figures,” the spokeswoman said.
“Our clinicians work really hard to make sure people have their planned surgery as quickly as it can be arranged as they know that any delay can be an anxious time for patients and their families.”
The figures from health boards under freedom of information legislation show that 12,275 patients have waited longer than six months since 2016/17.
A patient at NHS Ayrshire & Arran was not treated until 577 days after the procedure was agreed, while another in Lanarkshire is waiting 550 days and counting.
Alex Cole-Hamilton, the Lib Dem MSP, said: “We knew the First Minister’s 84-day treatment time guarantee was being routinely breached.
“It is shocking to now uncover the sheer scale of these breaches.”
A Scottish Government spokeswoman said waiting too long is “not acceptable”, which is why they launched an £850 million plan to prevent it happening.
“The plan sets out action to increase capacity, increase clinical effectiveness and efficiency and design and implement new models of care,” the government spokeswoman said.
“We will continue to work with boards to ensure this additional funding delivers the substantial and sustainable improvements needed.”