Index: upgrade-functions.php
===================================================================
--- upgrade-functions.php	(revision 3186)
+++ upgrade-functions.php	(working copy)
@@ -302,7 +302,7 @@
 	}
 
 	// populate comment_count field of posts table
-	$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments GROUP BY comment_post_ID" );
+	$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
 	if( is_array( $comments ) ) {
 		foreach ($comments as $comment) {
 			$wpdb->query( "UPDATE $wpdb->posts SET comment_count = $comment->c WHERE ID = '$comment->comment_post_ID'" );

