I suspect I'll have something on this site later next week.
As far as image quality goes, I don't think there's any doubt that the 5D MkII (given the right lens) will outperform the 7D, which will in turn outperform the 40D. However the differences are smaller than you might think and will probably only be visible in larger prints (over 11x14) on careful observation. There are certainly no "night and day" differences at ISO setting up to, say, 800. At high ISO settings the EOS 5D MkII is visibly better I think.
So if you're shooting in low light levels and/or want the smaller DOF that full frame allows and/or you're making large prints or heavily cropping then the 5D MkII is the winner.
If you have a bunch of EF-S lenses and/or need to save $1000 and/or need to shoot at 8fps and/or shoot lots of sports and/or need an electronic level, then the EOS 7D would be the best choice.
If you want to spend a minimum amount and yet still make excellent 11x14 prints and you don't care about shooting HD movies then the 40D (or 50D) would be the right choice.