This happened to me at Suvarabhumi several years ago becasue my connecting flight was late, I had already been through immigration, it is the airline that keeps your passport, the airline accompanied me to the hotel with passport for check-in. It is standard procedure.
I managed to get on the next flight 24 hours later, the problem is your bag is airside. I made a fuss about wearing the same clothes for 40 hours and they gave me a voucher for a pair of shorts and casual shirt from the hotel shop.