Can you not use your "old passport" to get out of Thailand and your "new passport" to get back in ?
It does seem odd that you have this situation, because normally you need at least 6 months left on your current passport in order to enter. Perhaps some more information is needed here, i.e. are you talking about another visa exemption (30 day stamp) or else using the next leg of a long term visa ?
It might be worth looking at
Home - Thaivisa.com as well.