Okay, so here's my dilemma. I saw this argument at MegaConvention2013, where someone wanted to use Emergency Force Shield as an immediate action to prevent this massive thing from basically one-shotting him.
Using an immediate action on your turn is the same as using a swift action and counts as your swift action for that turn. You cannot use another immediate action or a swift action until after your next turn if you have used an immediate action when it is not currently your turn (effectively, using an immediate action before your turn is equivalent to using your swift action for the coming turn). You also cannot use an immediate action if you are flat-footed.
The restriction is that you can't use an immediate action flat-footed. However, there is a little bit of an enumeration problem here: when an immediate action is used, when CAN it be used? It says that it can be done out of order, so it can be used as a reaction, which is specifically listed on some spells:
If you use this spell against an effect that also targets you or includes you in its area, you suffer the effects for both yourself and the target you spared, potentially taking damage or suffering other consequences twice.
When you cast this spell, any good creature within range is healed for 1d6 points of damage per two caster levels. All evil creatures within range take the same amount as damage instead (a successful Will save halves this damage). In addition, all allies and enemies within range are affected as if by the prayer spell for 1 round per caster level.
Which are two good examples of spells that specifically list when the action can be taken (as a reaction to an action). However, Emergency Force Sphere is another story:
Normally this spell is used to buy time for dealing with avalanches, floods, and rock-slides, though it is also handy in dealing with ambushes.
This does not list a specific action when it can and cannot be done. As a GM, I've always listed Immediates as Reactions, which can be done prior to another action if they are not flat-footed against it. However, this GM ruled that it could not be done as a reaction to an attack, and must be done post-turn, which didn't sit right to me. So, I'm bringing it to the Rules Questions boards.