I think that after the events of the Princess Quest ending, Gregory went back to the Pizzaplex to grab a new suit and endo for Freddy. The suit happened to be the prototype suit. On the way out, an earthquake came and caused a fire; trapping him inside. After the workers had plastered the window with newspapers, he found his way to the front and chucked the suit through the window and used the boxes to escape. He later fixed Freddy, went to do something, and took a long time. In that time, The Mimic sent Freddy a message just like cassie and tricked Freddy. He took the elevator to get there faster but had to go through the bakery. At the entrance to the bakery, he encountered a locked door (which he kicked down (shown by a Freddy-foot-shaped dent in the door)). He easily passed through the security because his endo and head together put him in the system. At the computer, he deactivated the MXES program and was chased by mimic. Mimic caught him in Fazerblast, destroyed him, and tore his head off, also disconnecting him from the network. Now that Mimic was out, he set up the trap for his next victim (Cassie). Finally, he used wires to Jumpstart the MXES program (which errored the computer to say "Security protocols deactivated. Are you sure you wish to proceed?").
Q&A:
Q: If the window broke from INSIDE, then why are the papers facing inside too?
A: Have you never heard of wind?
Q: Why "chuck"?
A: It's the best explanation to come up with. It's also hilarious to imagine Gregory throwing Freddy's leg out a window.
Q: Why did Mimic only rip off the head?
A: Mimic has been known to not fully dismember the bodies