There's a big pile of SQL that runs periodically to correct denormalized star, pin, flag, and mod-flag counts on messages and rooms. It has a bit of a special-case for deleted messages: they always get 0 flags, 0 stars, and 0 pins, thus avoiding the need to delete (or zero out) those associated votes when a message is deleted.
This update query was altered yesterday to...
- ...be slightly more efficient
- ...only run once per day
Unfortunately, the change omitted the special-case that ignores votes on deleted messages. And when it runs, it runs for all messages ever posted. So after yesterday's change, it started counting flags on deleted messages...
Fortunately, flags expire after a week, so this only revived flags for flagged, deleted messages from the past week. That's why the count wasn't much, much higher.
Nick patched up the query and ran it manually. Going forward, the counts should be corrected every day.