Sold the 40D in the end (I preferred the bells and wistlhles of the D300 and I had more Nikon glass)
From my experience:
In controlled condition with preset exposure and in the range 100-1600 ISO there was very little difference between them if you activate the chroma noise reduction on the 40D. I would go out on a limb and dare to say that the 40D was slightly better at 100 and 400 ISO while it was a draw at other sensitivities.
At 3200, the D300 clearly takes the lead.
In real life conditions the D300 usually performed a lot better because of of several reasons:
1) The matrix meter sometimes gave hugely better results than the evaluative metering which often made pictures too dark which resulted in unnessary noise
2) The superior auto ISO function of the D300 always picks the optimum ISO
3) at 3200 the D300 takes the lead
4) NR on the D300 can be set off,low, normal,high (40D off/on) and in low mode it works really wel.
The following is an example of the metering difference:
200% crops, ISO1600, NR off on both cams
Left is the D300 automatic exposure
Middle is 40D aytomatic exposure
Right is 40D with +1,33 EV compensation
As you can see, it is the matrix metering that makes the difference in this picture, not the sensor.
If you use the same exposure, the results are very similar
Even in very low light where T & A are at their limit, the fact that the D300 meters hotter, makes it use/ask a higher ISO which means less read noise and a brighter picture. Resulting in good noise performance.
Caveat Lector: these are my personal experiences, your mileage may vary.
--
cameras don't shoot people
People shoot people.