You cant create an HDR image from a single Raw file with any canera (since you can't magic dynamic range into existence) but you should be able to get the ultra contrasty tonemapped look from the D40 without difficulty. It's not the detail that matters for this it's the noise, and in favourable conditions (see next paragraph) the D40 is not noticeably worse than other DSLRs.
You wantFor the best results you should aim to minimisemaximize the dynamic range of your single exposure which means minimizing noise. To do this you want to get plenty of light so shoot a well lit scene, lowyou don't have to raise the ISO andsensitivity. You should also try to underexpose a little to be sure you capture the highlights.
You could enable active D lighting to do the underexposure for you, but I would recommend paying close attention to the camera settings (esp. ISO) to ensure you minimise noise.