Our web site throws up all kinds of W3C errors, and the code is a honestly a bit of a mess. But that hasn't stopped us holding top positions on Google for some pretty competitive keywords over a sustained period. We have been planning to clean it up, as it does seem to affect our rankings in Yahoo and MSN. But after reading this thread I am having second thoughts - our Google rankings are too precious to take risks with.
There may well be 'invalid' code that makes a difference to search engines, but there is clearly also invalid code that doesn't. I have posted on this subject here before, and got some quite confusing responses which had very little in common with each other! I did some research elsewhere as well, but I have never been able to find any real consensus about which aspects of code validation are important from an
SEO POV, and which are not.