There is serious post-processing done as @ahockley said.
What you seem to imply and I think should be addressed is that the Nikon D40 is not capable of producing outstanding images. Despite being entry-level, a D40, as all similar DSLRs, can produce almost any image which is possible by a high-end model when viewed up to a certain resolution (if the image fits on-screen, your are definitely below this limit).
Higher-end models have features which make them more desirable for professionals such as a 100% viewfinder, weather-sealed body, dual-control dials and higher frame-rates. If you think about these carefully, it is easy to figure out that none of these actually affect the quality of images. They certainly let you work faster, in adverse conditions and even spare you some spurious cropping but nothing to do with image output. It does not matter if you got the shot while shooting a 3 FPS instead of 12 FPS or using one dial instead of two for the outcome!
What has an impact on image quality far more than the camera is the lens and the D40 can work with all top-of-the-line Nikkor lenses. On some it cannot autofocus but this is not necessary to get a quality shot anyway.
All this to say that with only a minority of exceptional circumstances (extremely high-ISO, super-fast speeds, terribly adverse weather), if a photo is impossible to make using a D40, it is impossible on a DSLR at any price.