First you must defeat Vile in the secret factory that is accessible by hidden teleport chambers in Blizzard Buffalo's stage, Volt Catfish's stage, and Crush Crawfish's stage. At any of these locations find a purple teleporter, it will take you to the secret factory. Go through the factory until you find Vile. He will attack you riding a K-armor. First destroy the armor, then Vile will fight you himself. You must destroy him using the Spinning Blades or else he will escape. Vile must explode in order for the trick to work. Then you must escape from the factory before it explodes.
When you get to the second part of Dr. Doppler's lab, there will be some changes if Vile was destroyed. When you get to a robot ride armor platform, get into a F-armor, because when you go down, the level will be flooded. Now make your way to the mid-boss door. Before you go in, switch to Zero and go in to face a mosquito/bug like mid-boss. Have Zero defeat the bug and it will explode on Zero. This will leave Zero highly damaged. He will give the beam saber to Mega Man X. To use it, charge the X-Buster until you turn green, you'll fire 2 charged shots and then the sabre. The beam sabre is very powerful and can kill all the bosses with only 2 swipes, even Kaiser Sigma.