Thanks for tracking this down. It comes down to a closing bracket being in the wrong place, so some code gets executed on any edit to any topic replies. The fix.
Line 476 of scripts/modifypost.inc.php has this:
} // end if
$query = "
delete from {$config['TABLE_PREFIX']}CALENDAR_EVENTS
You need to take the "} // end if" line and move that down to around line 494. Right before: