Don't threaten legal action unless you already plan to follow it through: companies know this is unlikely to be followed up and will stonewall you.You actually do have to follow through if you're going to play that game. Otherwise almost everyone is just going to call your bluff, and I'm reasonably sure CS reps are now being actively trained to do so immediately at many companies. For example, any implication that you'd like to close an account or cancel an order will just be met with "I can do that for you immediately if you like", and if you don't take them up on it then they know you're not serious and you've lost any sort of credibility or leverage you might have had.
So, actually follow through. In the UK, suppose you have a legitimate grievance but get messed around by customer services, who may of course be incentivised to do exactly that. You may get better results by desisting from dealing with CS reps and instead sending a letter with verified delivery to the company's registered address. Clearly set out your grievance, what you would like them to do about it, and a reasonable amount of time you will allow for that to happen. Also include everything necessary for it to constitute a letter before action, which is the first step to a formal small claims action here, and possibly give a simple, objective statement in your letter that unfortunately if the matter is not resolved amicably by your stated deadline then you will proceed with that action.
IME, at that point your case may well be transferred to someone who actually knows the law and will be able to see if they have actually broken it or have obligations under it. And if they do, they'll know that it's in their best interests to resolve the matter quickly and agreeably if possible, and you may well get a response proposing some reasonable resolution (or saying that they'll stop chasing you if they've been hassling you after making a mistake).
If they don't do that, then actually bring the small claims action. This is designed to be accessible to normal people without requiring big expenses and professional lawyers. A lot of companies will apparently just not show up and let you win by default in that case, and you'll get some reasonable compensation for whatever wrong they've done to you. And if they do show up and you have a reasonable grievance, there's still a fair chance you'll win reasonable compensation accordingly.