Here's how I look at it: cameras are like knives. They all cut.
The D300/s are the swiss army knives of the DX bunch. The D40 is your good quality kitchen knife.
Now if all you do is cut, then the swiss army knife is overkill. What would you need a built-in screw-driver for. If you only turn screws very very rarely, well then even the kitchen knife works.
90% of a good image, comes from you, the shooter. 8% of the rest comes from the lens and 2% from the body.
I have and use both the D40 and the D300. All in all, I think that the D40 produce better images than the D300. I've printed both 6 and 12 MP images at 12X18 inches and there is zero evidence in my eyes, that the extra 6MP makes ANY practical difference whatsoever.
Yeah in theory, if you're an eager cropper of your images, 12 MP is better. And that is true...but I'm not a cropper.
The only reason I have and use a D300 is for paid event-gigs, where I need buttons and dials for everything so I can make changes fast and easy. Decidedly not because I believe it gives me better images. In fact, the weight of it, along with my metal flash-bracket and umbrella-holder, makes it too damn heavy to be pleasant when doing a 12-hour job.
It's also handy for off-camera flash, because it has built-in flash command. So I use the D300 for that too. And for the AF-D lenses, the built-in AF motor in the D300 is handy, but the AF-S lenses focus faster, so it's not critical. The settings-banks where you can switch a whole SET of almost every setting all at once, is handy. But also not critical.
The D40 has 1/500 flash synch which is far far superior to the D300, for example. The very fact that the file-sizes are inherently so much smaller too, really is helpful in terms of buffering. The D40 can shoot an entire card full in one long fast sequence, the D300 fills up it's buffer every now and then, and you wait.
In other words, it's very important to decide what is important to you and what it's worth. And always held up against: what else could you get for the dosh?
If 99% of all your images are only seen on a monitor, the D40 is much much better, because the image is not compressed as much. A 24-inch monitor has just over 2 MP.
But if you are just interested in a body that allows you more direct options to play and experiment with - bracketing or faster shooting etc. and just the sheer joy of having a more hefty and feature packed camera - with video and audio recording even, then just go for it and never look back.