Only visa exemptions ON LAND BORDERS are limited. You could, technically fly in and out a million times. That's not restricted but eventually you may be asked. Tourist visas DO NOT COUNT as a land crossing, so again, technically you could cross land borders a million times if you obtained a TV before entry.
You can fly out then back in as many times as you want. Some seem to get questioned at arrivals but there's technically no limit on it. That gets you the 30 days and then you extend 30 more.
has mentioned in the comment below, it seems to be more costly than when I was there 10 months ago... things change here with zero notice! Or maybe I just got lucky
crazy how quickly things change in that case! I was there a couple nights, no visa fee and paid an agent 350 baht... got it next day. That was about 10 months ago