I’ve been in this situation due to misunderstanding the requirements. Go to an immigration office, be polite, explain your situation, and if you’re lucky enough to get a reasonable immigration officer, they will show you how to solve the problem. You don’t need an agent but it might make it easier, and it will cost about 20,000 baht or so. The other option is to leave the country and re-enter but that will likely cost that much or more, is a pain, and could go wrong. Good luck.