Are you using email polling for mail fetching? If so, is it set to delete messages after it fetches them? If you are using POP mail instead of IMAP, you will need to check this, so the script won't re-download the mail the next time it fetches.
My other thought would be to make sure the osTicket database user has delete privlidges for the database.