Check with Thai immigration what you need to do when you leave on an Emergency Passport that will not have your entry visa exemption stamp, issue is that Immigration will still need to see you haven’t over stayed.
should also keep a copy of/ pic of the immigration stamp that you obtained on entry which makes it easier for the police to see you are not breaching your visa expiry date and the BIB’s then don’t need to engage with the Immigration police.