I was tooling around, and decided to quickly buy some citadel upgrades. After testing this out on items as well, it basically works like this:
If you buy items in rapid sucession, the lag time between it being clicked and being 'registered' will let you queue up multiple items to buy, even if it exceeds your gold count. For example, with 5000 gold, and fast clicking, you could buy both Angels and Fortress Catapults at your citadel, and wind up with 0 gold (but spending more than you have). This is...pretty bad, though I'd think fairly easy to fix.