Don't confuse a visa (obtained outside of Thailand at embassy or consulate) with an extension of stay (obtained within thailand at a local immigration office).
You are on an extension of stay for a specific reason: In this case employment. The day that you quit or the day that you are terminated, your extension is technically invalid on that day. But in practice, it may take a few days for your employer to notify immigration, ministry of labor, etc. Some employers may never actually contact immigration. That doesn't mean it is valid. It's just that it works in your favor as the computer still shows a valid extension. But I don't recommend relying on this as you risk being in an overstay condition.
You can do what a friend recently did: do an out-in border run immediately. Explain If questioned, explain to the border official that you quit your job or you are getting a new job, so the current extension is not valid anymore. Because they might think you are simply wanting to leave, but forgot to get a re-entry permit as the computer still shows a valid extension. You can also go to local immigration to ensure the existing extension is cancelled and get 7 day extension for 1900 baht. But I would try a border run first. Gives Usually cheaper and gives you more options.
Another tip: if you are married to a Thai national, do the extension based on marriage. This way if you have a fallout with your employer, your extension is unaffected. OR get a multiple entry non-"O" or "B" visa . You would have to do border runs every 90 days vs 90 day reports at local immigration. But your visa is still valid in case you part ways with employer or get a divorce.
Although it is getting more difficult now to get multiple non-immigrant visa than in the past, but for legitimate marriage, work, or retirement, you should still be able to get it. Only time will tell.