Yep, you CAN fly to a country, NOT stamp in or out of it (staying in the transit area of the airport) and then fly back into thailand. However it has to be a country where you don't need a visa to enter OR you won't even get past the check-in window of the airline ;)
You will be required to show your boarding pass when you get stamped back into thailand, AND you might be questioned on WHY you didn't bother to stamp in or out of that country BUT you can certainly do it and won't be denied entry into thailand.
I say this because
@Amor****
, has confirmed it can indeed be done, especially with Malaysia. :)