Alrighty.. so do some debugging. Put echos at the start of every function that could even theoretically be causing it, and run the server and wait for it to crash. Check the last line written, and you know what function caused it.
The only general advice I have on this topic is to make sure that you schedule the deletion of a vehicle, not just call %this.delete(); inside of a method on that vehicle. In all cases.