Emergency passports are expensive and they won't issue it while you have your passport. Send off passport as soon as possible and if it doesn't get back in time, you can then apply for an emergency passport to exit and re-enter. You need to leave Thailand and travel to a country that accepts emergency passport.... Not all do. I think Hong Kong is still the nearest one