Even though the 450D has more MP, the sensor in the 40D is better, it's more advanced and has bigger microlenses so it's going to be firstly more sensitive, and secondly better at higher ISOs.
Image quality wise they will be almost identical.
The 40D is better than the 450D, there are plenty of features they share but the 40D excells in the most important areas (like build quality, frames per second, AF).
I have a 40D and love it, i'd NEVER get a 450D over a 40D. Definatly worth the extra cash (and to be honest the price difference isn't huge between the 450D and 40D at the moment, the 40D has a cashback offer on).