It's a tough call. I really see them as being complements rather than replacements. Maybe if the 40mm was a stop faster at f/2.0, there would be more of a comparison, but they really are 2 different lenses. Especially on a crop body -- 50mm is too long for many applications, but 40mm is almost wide enough to be considered normal. And f/2.8 isn't fast enough for the truly low-light situations where sub-f/2.0 lenses really shine. The 40/2.8 is designed for size/portability, to be moderately fast, and to be a "reasonably close to normal" lens for both crop and full-frame bodies. (Oh, and the special motor for shooting video.) The 50/1.8 was designed as a fast, cheap normal lens for full-frame, and doubles as an excellent portrait lens for crop.
Flip a coin? Or weigh the kind of shooting you do and what your desires are? Unless you have truly tired of the size+weight of your body and lens, I'd probably go with the 50mm as it is still super light, reasonably compact, over a stop faster, and half the price.