Is there a way to prevent a Macbook Air from sleeping when external monitor is plugged in but power is not? I have a 13-inch Mid 2012 Macbook Air running 10.9.3. I usually run with the lid closed plugging into 2 Apple cinema displays. Everything works great, except when I accidentally bump the power cable, at which point it goes to sleep.

Is there any way to prevent this? Clearly it isn't a power issue, because with the lid open and no power cable it drives all 3 monitors just fine.
The power adapter is required for closed display mode on any Apple portable machine, without it you can't use closed display mode. 

Reference:  http://support.apple.com/kb/ht3131

There is however a third party solution, called Caffine.  Which when enabled, forces the mac to stay on until the battery dies, it won't ever sleep.

http://lightheadsw.com/caffeine/