When confusion takes over, it's almost always about a lack of focus on the intended use. Make a list of what you want to use the new blaster FOR, then match the action type/maker/model/caliber to the intended use(s). Personally, if you already have a nice .45 (and it sounds like you do), then there's probably not much you can do with a .40 that you can't already accomplish with the .45.
If you want a cheap-to-shoot range gun, then a 9mm is probably the best choice, based on ammo costs alone. I have owned several Beretta and Glock nines, and they are all as reliable as the sunrise, accurate (once you get some practice under your belt), and inexpensive to shoot (so you can afford to shoot enough to get REALLY good with it).
Another option might be to buy a Glock .40 and an aftermarket 9mm barrel and a few 9mm magazines, and have a larger caliber for more serious pursuits and a drop-in barrel for cheap practice (although the recoil impulse is higher with a .40, and you really should practice with what you carry for intimate familiarity -- IF you ever intend to carry it). I'm not a fan of the .40, but many folks are, and as long as you don't mind paying the higher per-shot cost, a Glock .40 will serve you well.
Not a fan of the XDs in 9mm or .40, so I'll let someone else do the selling on those.