Long layover in BKK with through-check baggage
On the way back to Thailand, if I check through baggage to, say, HKT or CNX, and have a long layover at BKK, can I get out of the airport during this layover? Would this mean immigration protocol at BKK, but customs at the final destination? How will my baggage be treated differently from other domestic passengers at the destination airport?