Words of wisdom... Read fhotoace's and cabbiinc's answers and see which side of the fence you sit on. Both have given you excellent but opposite answers, so it depends on YOU as an individual.
I don't have a lot to say about this, but here's something I wrote a long time ago that might help you decide. I'd lean towards the D40X, since it's "only" $135 more and you sure can't buy a decent lens for so little money.
There are a few slight differences in these cameras that need to be considered. Rather than write it all out, I'll send you to a few sites.
See: http://www.kenrockwell.com/nikon/d40x.htm
See: http://www.popphoto.com/cameras/3896/camera-test-nikon-d40x.html for a glowing review.
See also:
http://www.popphoto.com/popularphotographyfeatures/4431/top-25-best-buys.html
http://www.bythom.com/d40review.htm
http://www.dpreview.com/reviews/compare_post.asp?method=sidebyside&cameras=nikon_d40%2Cnikon_d40x&show=all
See also:
http://www.nikonians.org/dcforum/DCForumID201/17255.html
See the REVIEW here:
http://www.dpreview.com/reviews/nikond40x/
As far as the pixel issue, I say, if you have no other basis for making your decision, go for more pixels. If you always plan to compose your pictures perfectly, you don't need a whole lot of pixels. If you want to allow for cropping, which means enlarging only a portion of your image, the more pixels the better.
Imagine taking a scenic view and then noticing that the middle 20% of the photo would make an even better picture. Suppose you take a picture of a whole group of people and Aunt Clara really, really looks great in the picture, but everyone else looks lousy. If you have the pixels to work with, you can still make a decent print of Aunt Clara that she would be happy to have. If you buy an 8-to-10 MP camera and don't want to TAKE large photos, you can always set the camera to a lower file size. You can never go the other direction, though. Unless the cost is a major issue, buy the camera with more pixels. You will never be sorry that you did, but you might one day be sorry that you didn't.
I have a few photos on Flickr to include in a discussion on how many pixels are enough. Go to my page at http://www.flickr.com/photos/samfeinstein/tags/pixels/ Some of the pictures are from a 4 MP or even 3 MP camera, showing you what you might expect without any cropping. I think they are quite acceptable. Some of the pictures are from a 10 MP camera (the swan and the pansies), showing the value of having those large images so that you can crop a smaller image out of the original picture and still end up with a satisfactory image.