On arrival at BKK you will follow signs with the arrivals area for domestic flights and clear Thai immigration. At Samui you'll clear customs with your luggage. Your bags will be checked through.
At Samui they should again be able to check your bag to LHR. You will also clear Thai exit immigration at Samui. On arrival at BKK there will be staff to direct you to the international departures hall.