Since phpBB 3.1.0, you can erase a post without remove it in the database (actually, you hide the post for anyone who hasn't the moderator permission to restore it). The last post of its topic and its forum is updated to exclude the "erased" post.
If a moderator edits the hidden post, he or she restores it. Perhaps it's intended for phpBB team. However, the last post of its topic and its forum is not updated. You have to resync its topic (or forum?) to update it.
If you restore an erased post without editing (without going to the post editor), the last post of its topic and its forum is correctly updated.