Gandalf saving during an attack

By havasmezoi, in Rules questions & answers

Dear Fellow Players, I am new to the game with only one Core Set so far. My question is: is the following move legal?

I am in the Combat Phase with a Forest Spider engaged (it has 2 attacks since it is not it's first round). I decide the attack goes undefended. I flip its shadow card which adds +3 attack: instant death for any of my heroes.

I have no shadow cancellation, no Feint, nor can I put the Spider back to the staging area. So I play Sneak Attack and put Gandalf into play. He instantly deals 4 damage to an enemy in play, which of course kills Forest Spider. Therefore I don't have to resolve its 5 attack. Hero saved.

Is there a place to play Gandalf this way between flipping the shadow card and resolving the Spider's attack?

Thank you!