Does an item effect still occur if you go insanse/unconscious using it?
If a cost associated with a spell or exhaust card leaves you at 0 stamina or 0 sanity it will resolve before you become injured or insane at the location you cast it.

What about Flute of the Outer Gods? 
After the injury or madness, the spell resolves(Either its success or failure state) in the location in which it was cast the spell.

You then become injured or insane and are transported to the correct treatment facility.

Other spells that does not have such dramatic effects (Like plus to combat checks) are rendered useless since you can not perform a combat check after the spell has resolved against the original target which resides in another location.