I guess the question is, is he looking at the date of the original visa or the date of the last extension?
Get your passport renewed asap and then get the stamps transfered to the new one (if they are still valid)
Otherwise you might be looking at leaving Thailand reentering visa exempt and then appling for a new non-O.
If you are on overstay already that could complicate things depending on how long it has been.