@Stuart ********
Never been in that situation before. Only once have I left on the last day of my stamp, but that was in the afternoon. Still, it makes no sense to stamp overstay if you're on your last day, regardless of your flight leaving after midnight. Especially if it's 0020, you'll be going through immigration well before midnight. Are you sure officers some officers see it differently? Any examples?