In answer to your question, at base ISO, the D40 will be a little better than an ultrazoom. At higher ISOs, the D40 will outperform the ultrazoom by a lot. ISO 400 looks pretty bad on just about every fixed-lens camera, but is completely usable on all the entry-level DSLRs (although the Olympus models fall behind compared to the others). And as long as you expose properly, ISO 1600 looks great. That's a lot more latitude in lower light conditions and action where a super-fast shutter is needed.
Nikon D40 + kit lens
Nikkor 50mm f/1.8 D AF(...or not)