NEF is superior to JPEG in terms of compression - It doesn't have as much compression at work in the file. When a file is compressed you lose a good deal of details from the shot.
JPEG can fully fully adjusted with any version of Photoshop, that has no bearing on the NEF/RAW vs. JPEG argument.
The conversion will lose details in the photo, you cannot avoid this. You can mitigate it by altering some minor details in photoshop (sharpening tool, etc) but
overall you will lose details, just a fact of life.
Your image capturing problem stems from the fact that the D40 only has a few points of capture for the sensor (most professional DSLRs possess hundreds of ponts). You can overcome this to a degree by altering the points of focus. I noticed that when I chose "closest target" vs. "dynamic area" on my D50 that I usually got the subject focused pretty well. Give that a shot. You should be able to see this in the viewfinder before capturing an image, give your trigger finger a rest

.