I have the Canon EF-S 10-22mm and I love it. Currently use it on a 50D. As it is such a strong lens I don't think you've have any trouble selling it for pretty close to what you paid (the thing I hate about good lenses, you can't buy used ones cheap enough to justify NOT buying new in my opinion) if you ever decide to upgrade to the full frame camera.
Also keep in mind there's a decent chance you'd keep your 40D even if you did upgrade, making the EF-S lens lineup still useful to you. I had an original Digi Rebel 300 and a brother that could really use it that saves me lots of money helping me out with house stuff (mostly electrical work) so it was handed down to him... but I will never get rid of the 50D even if I do upgrade to a FF camera.