From https://www.thaiembassy.com/thailand-visa/visa-overstay-thailand
(I do not know who publishes this site, but the information is consistent with what Immigration has said in the past.)
If you are caught in Thailand as an overstaying foreigner you will be detained and face punishment. However, if you leave Thailand as an overstaying foreigner without being caught you will only face a fine and possible ban from re-entering Thailand, depending on the length of your overstay, when exiting through immigration control at the airport or land border, and will not face any imprisonment or detainment.
As you can face detainment and imprisonment even when overstaying by just one day, it is important to avoid getting caught or being questioned by police, and resolving your overstay issues as soon as possible. On occasions, immigration police will do random checks on foreign nationals on entertainment centers, on the street and some checkpoints.