While your idea is sound, the gun should be kept on-body. How long does it take to find the key and get to the file cabinet? What if the shooter is between you and the file cabinet? On-body carry, done correctly (namely, a retention strap-I think that's what it's called-I don't use one) would be the way to go.
Also, a stun gun requires a closer proximity than a pistol. Thinking from the bad guy's head "Oh, stun gun. First target chosen" as opposed to "holy crap, Batman, that teacher's got a gun!"
He had a Bushmaster with two 30 round magazines taped together (along with two handguns). Like you said seems like a stun gun (especially one locked away) would not have been effective. How well would a minimally trained teacher or principal have done with a concealed gun? Remember in the Sikh temple shooting a forewarned police officer was shot as the first responder. The Sikh shooter was taken down (actually killed himself after being shot) by two officers after one was shot by him. The shooter used a 9 mm semi-automatic handgun. What would be interesting would be a seeing some simulations with typical CCW holders responding to being surprised by a gunman like in Colorado or in this shooting. How well do you think you would do being unprepared?