Actually I wouldn't delete the target forum. The topics and posts are a bit mismatched with the bug. I'm making a fix script for you now. You'll want to backup your database before using it however just to be safe.

As for the fix to prevent this from happening. Line 255 of admin/domovethreads.php looks like this:

where TOPIC_ID='$postrow['TOPIC_ID']}'

that needs to be:

where TOPIC_ID='$topicid'