The 40D is a good camera, and $400 is a pretty good price. You're getting very good bang for the buck.
I wouldn't call the 40D the "pinnacle" of the xxD line. However it's the camera where sensor technology became mature. Earlier cameras had great leaps in technology between models, and later cameras have features that are perhaps beyond the point of diminishing returns. Returns, but diminishing returns. The 60D is a slightly better camera than the 40D. But the 40D is vastly superior than the 30D.
5D II, 7D, 40D, 20D (IR)
28-300 f/3.5-5.6L, 35-350 f/3.5-5.6L, 70-200 f/2.8L, 70-200 f/4L IS, 200 f/2.8L, 135 f/2L, 100 f/2.8L, 24-105 f/4L IS, 85 f/1.8, EF-S 17-55 f/2.8 IS, EF-S 15-85 f/3.5-5.6 IS