nick, i think you forgot one little detail.. if the thread is deleted, the previewpostid will still be there. you could do this:
open functions.php and go to [high]deletethread()[/high] function.
find:
Code:
$DB_site->query("DELETE FROM thread WHERE threadid='$threadid'");
BELOW this, add:
Code:
$DB_site->query("DELETE FROM thread WHERE firstpostid='$firstpostid'");
let me know what you think.