Not surprising to learn that the pretenders can't match it with an SLR. That does not come as any surprise to me.
Personally, I think if you are upgrading from a D40, just go straight to the D7000. Moving to the D3200 is not an upgrade and I don't think the upgrade to the 5100 is really worthwhile as you won't gain that much more, but I think the video is not bad.
My D40 has just retired to be replaced with a D800 after a year or two gathering FX lenses. I agonised long and hard about whether to stick with DX format and go with the D7000 or move to FX. In the end, I went for FX and spent $4k-$5k or so on lenses before buying the body and waiting for the D700 replacement to hit our shores.