The D40 represents a fairly bold move by Nikon to squarely target the novice user, and a segment rather unkindly referred to in the US as 'soccer moms'. Having said that, some pros are using it as a light and cheap backup body!
A lot of the advances of the D40 are in user friendliness, and aiding the user to get good results straight from camera. This means better jpg processing and lower noise at high ISO (probably also due to the newer processing engine). Dropping the screw drive has saved money and weight, and clearly Nikon market research has shown that the vast majority of the target market never strays from the Nikon consumer AFS lenses.
If you post process, and in particular if you shoot RAW, I doubt if you'll see much (any?) difference between the D40 and D50 results.
Having been initially skeptical about the D40 due to the lens issues, I've come to the conclusion that most mainstream users aren't gong to be particularly hampered by it. Prime addicts, low light shooters wanting a 2.8 zoom, and macro fans should avoid the D40, but for anyone else, I don't think there's a problem.
So, in short, D40 wins on image quality, but D50 users can make up the difference in PP. D50 wins on lens support but most D40 users won't ever notice.
If you are looking with interest at budget Sigma, Tokina and Tamron lenses, then I would say that a D50 is a very good choice.
The key lenses that the D40 is missing are
cheap 17-55 2.8 zooms
35mm prime
50mm prime
85mm prime
cheap macro lenses
I really do not see the entry level user segment supporting the development of AFS versions of these lenses by Nikon. The best hope is more HSM goodies from Sigma. Tokina have just launched the 18-50mm 2.8 in Japan, but yet again it's a screw drive lens