Different people seem to have differentresults in low light with the 50D, in theory the greater number of MP over the 40D should make it 'noisier', I dont have a 40D but I have both a 1D (mk 2 - 1.3 crop & 8 MP) and a 50D, the 1D is much better at a high Iso than the 50D.
5D vs 50D will be even more noticeable in terms of IQ and noise at high ISO, BUT, no idea how good the 5D AF is in low light, so if it cant focus it wont get a better shot.
I wouldnt upgrade from a 40 to a 50 though as my 50 is noisier than an old 10D I have and from what I have read the 40D is better than the 10D, so a 50D will probbaly be a downgrade in terms of Iso performance. The 50D has some qualities over the 40D that means moving from say a 10/20 the 50D would be the better choice (caveta the Ios performance), but not a good move from 40 to 50 seems the conventional wisdsom. Might make sense to move to a 7D though.
Matt