I guess you have a big stamp in your passport with in line 2 the text "Extension of Stay permitted up to
*****
/2024.
Buy a Single Re-Entry Permit at your local Immigration office, cost 1.000 Thb, leave to Europe, apply for the new passport, come back using BOTH passports, get a new entry stamp Admitted until
*****
/2024 in your new passport.
And apply for a new Extension of Stay by handing over both passports, your idea is good, simple and can be done without any problems.