Index: wp-includes/classes.php
===================================================================
--- wp-includes/classes.php	(revision 13299)
+++ wp-includes/classes.php	(working copy)
@@ -480,14 +480,17 @@
 					status_header( 200 );
 				return;
 			}
-			$wp_query->set_404();
-			status_header( 404 );
-			nocache_headers();
-		} elseif ( !is_404() ) {
+			if( apply_filters('handle_404', true) ) {
+				$wp_query->set_404();
+				status_header( 404 );
+				nocache_headers();
+				return;
+			}
+		}
+		if ( !is_404() ) 
 			status_header( 200 );
-		}
 	}
-
+	
 	/**
 	 * Sets up all of the variables required by the WordPress environment.
 	 *
