But how do I declare the work permit null and void before I start the four week count down? And surely I can return after to the uk on the tourist 3 month entry period if I have to? How deos one 'end' a work permit?
In addition to what Wishstar has said, you would have received a P60 or P45 giving your dates of employment, and the HO can look it up any time they want. And they absolutely *will* check it out if you attempt to enter a migration path towards permancy. That's for sure.
To answer your question specifically, your work permit ends on the date shown on your P60 or P45. After that you have 28 days.
It is possible to arrange an in-country switch from a WP to a visitor and extend your stay for up to six months and they are pretty empathetic about granting it because it's difficult for a worker to just up and out in 28 days. *BUT* you need to have unspent leave on your existing visa in order for them to consider it. If you are without unspent leave when you apply, they can still do an exceptional if you have compelling grounds. If they make an adverse decision, and you leave the UK with remaining unspent leave, you do not have to record the refusal on subsequent VAF forms. The tribunal has upheld this point already.
Contrary to what others have said about leaving the UK in the event that you are already illegal: I would gently remind the folks here that leaving the country is not something you would advise a vandal, burglar, shop-lifter, pickpocket, or other law-breaker to do, is it? If he's in breach, especially with a documented work history, he needs to get qualified advice and get it sorted out.