*disclaimer* I am not a photographer and I don't own either camera */disclaimer*
More megapixels doesn't necessarily equal a better camera. The D40x and the original D40 both use a DX format CCD, so what they have done is cram more, tinier sensors onto the same size wafer. This is good if you want the kind of resolution where you can see people's nose hairs, bad if you like to shoot at high ISO settings. The base ISO for the new model has dropped from 200 to 100, which affects me none since I shoot everything at ISO 100 anyhow, but if you are buying a semi expensive "Prosumer" camera I assume you want more out of it than you would get with a cheaper compact.
That being said, I imagine the D40X will take stunning daylight pictures at 10MP resolution. The extra resolution is really handy if you crop your photos a lot, but if not I wouldn't base your decision on what is mostly a marketing number.
Also, have you looked at the Canon Digital Rebel/XT/Xti series? They have a good rep and are in the same class and price range as the Nikon D series. Obviously if you already own Nikon lenses you can disregard this.