Airports which open 24 hours do. You have a valid boarding pass so youre allowed to go airside. Its not uncommon to spend 24 hours in a transit area anyway.
Even airline lounges let you use the lounge the previous day "unofficially" if youre eligible.
If you’re leaving out of BKK and have no checked in bags you can get a mobile boarding pass up the day before your flight so you can stamp out of Thailand before your visa expires.
Then you stay in one of the transit hotels, lounges or rough it in the terminal.
You’re technically still in Thailand but not officially.