@Bob *********
You have until the date printed on your termination letter, which is usually a few days to a week or two after your job ends. Provided you don't go to immigration to cancel on the last day, you have until that last day on the letter. You can also get a 7 day extension on top off that, which is known as a "denied extension" extension and costs 1900 Baht.
If on a non O or non B 3 month single or 12 month multiple entry visa, then the job isn't tied to the visa and can stay for as long as that visa allows.