SRD said:
Enemies attempting to attack you or cast spells at you must select from among indistinguishable targets. Any successful attack against an image destroys it.
Emphasis mine.
Since the images are "indistinguishable targets", spells which require targeting must target a random image - and further, any spell which can target you can be wrongly targeted at these images. This much is clear from the spell description.
Open to interpretation on the other hand: An image is destroyed by being attacked, or -
I presume - by being targeted, though that's not entirely obvious. Of course, it would truly be affected in the real sense, but that's not different from an attack: it doesn't have any hit points, isn't real, and yet attacks can destroy them. Hyp's interpretation that you need to choose randomly, but choosing an image
has no effect makes sense too. In any case, the caster must randomly choose which image(s) to target. As green slime says, which way you go isn't that important, as long as you're consistent. I think you're better off popping images if they're targetted game-play-wise, but consistency rules!
Since the spell specifically refers to enemies, allies shouldn't be effected. You could imagine this being possible by you helping your ally identify the "real" you (eye contact? lines in the sand? merging temporarily with the images perhaps?)
Cleave specifically refers to dropping creatures, not popping images, and shouldn't be triggered by popping images IMHO.
You definitely can use Greater Mirror Image as a defense against spell casters, and yes, it is pretty powerful!