Your best option is to fly out and back KL is good but stay one night.
You can extend for 30 days at your local immigration office but this option makes no sense for you as it costs 2000 Baht the flight to KL if you get it right is about 1500 each way.
I returned with a 60 day tourist visa when it happened to me been in and out for 36 years only asked once! A friend who had the same problem and ignored it was deported on arrival!
Your fist move is to look up your local Thai ๐น๐ญ Embassy and read the Visa requirements on the visa application page, this will give you a good idea of what you will need .