The nicest things about D40 is the wide angle 18-55 mm lens (I know it is silly, I could buy just the lens), otherwise D50 is superior with its internal lens focusing motor which works with my old lenses.
As far as functions I need the following all manual: S, A, M, (basically shutter speed, aperture and ISO) so the fancy cameras with a lot of options make no difference to me, more primitive and simpler the better. Oh, Nikon D60 has sensor cleaning, which I would like to have, my old D50 has an annoying dust spot on all pictures.
I don't care for mega-pixels at all, they just eat the memory, however I do shoot in RAW just in case I get something really good, JPG compression is fine for Web, but it decreases the quality rapidly. I don't need more than 4.5 Mega pix, Nikon D40 has 6 Mega pix, Nikon D60 has 12 Mega pix and who cares!
In the picture below you can see the bird ("The Dove") that was taken with my Nikon D50 (4.5 mp) and the enlargement looks just fine to me: