I had the same decision to make a couple of months ago: buy the 5D or the 40D. Given my history of camera purchases, I just knew that as soon as I bought a 5D, Canon would release a new model. I played with the 40D and liked some of the features enough that I went ahead and bought one.
The 40D is my personal camera. I have a pair of 1-D Mark II bodies at work, and a 20D. Let me say here how much I *hate* the 20D. The image files are okay, but the usability is terrible. The 40D is a huge improvement over the 20D in almost every way. It is more responsive, quicker to focus and shoot, more intuitive to use, and the image quality is significantly better. If you have a 20D, the 40D is a solid upgrade choice.
Compare to the 1D2's, the 40D doesn't come off as badly as I had feared. Of course the user interface is very different, which is taking longer to get used to than I expected (but when I upgrade to the Mark III bodies, it'll be the same as the 40D). I've been shooting the 40D attached to my 300/2.8 at college basketball games and major events, and with a 17-35/2.8 for general shooting. I was *amazed* at the autofocus performance at the first basketball game -- out of 250 shots, I had maybe 15 that weren't in perfect focus. Yes, the 300 is a quick lens, but this performance was extraordinary. (I used all 9 focus points and just shot away whenever I wanted.) The focus is good under dim light, too, locking on very quickly.
Image quality is outstanding. I have several 13x19 full-frame prints at ISO 400 that are incredibly detailed and sharp. The 40D is slightly better than the 1D2 at ISO 800, and much better at ISO 1600. This despite the smaller chip size.
So why choose the 40D over the terrific 5D? For me it came down to features: the 14-bit raw files, the amazing and excellent auto-sensor cleaning, the large LCD, and the quick and responsive AF and handling. I don't have as much need for wide-angle performance right now, as I have other options for that. I will purchase a 5D replacement when it comes out, at which point I will have a 5D(2) with a 24-105, and a 40D with a 70-200 -- that's a pretty good setup that covers most of what I would want to shoot for personal use.
If you are going to buy a 5D replacement when it comes out, and you want a camera now, the 40D is certainly a decent option.