I just installed a wordpress blog for a friend of mine and encountered a strange problem. Installation went smoothly but the blog always showed error 500, while the admin section worked without a problem.
I digged into the code and found out, that the problem comes from a call to the method handle_404 inside method main of class WP.
It seems like my server doesn't like the output of the second 200 header. If i understand your code correctly, headers have been sent in send_headers already.
I'm not sure though, if this is a bug of your code or a problem with my server.