Lightly outline the approximate area where you'd like the cabinet to hang. Use a stud finder to locate any studs that lie within this outline. Using a keyhole saw, cut out 4-inch squares on either side of those studs, remaining within the cabinet outline. Be careful to not cut any deeper than the drywall and risk hitting wires or pipes. Remove the drywall cutouts. Shine a flashlight into the openings and look around for possible obstructions. Contact an electrician and/or plumber to move wires or pipes if necessary.
Have a friend hold the cabinet against the wall, positioned at a height that is comfortable for you. Typically, a medicine cabinet's top is 72 inches from the floor. Ensure that the cabinet is level. Trace the cabinet's position on the wall in pencil. Use a keyhole saw to cut along the inside of the pencil line. Remove the drywall inside your cut line, being careful not to damage the remaining wall. You may have to break off pieces of drywall still attached to the studs. Remove any loose debris and insulation. Slide a hacksaw blade behind the exposed stud and cut through any drywall screws holding the wallboard to its back edge. Use a handsaw to cut the stud flush with the opening at the top and bottom. Do not cut through the drywall attached to its back edge. Remove the cut stud.
Unscrew the cabinet's door, leaving the hinges on the cabinet. Set aside the door for another project. Save the screws to attach the mirror to the cabinet. Test the cabinet's fit in the opening. Use a rasp and utility knife to fix tight spots.
Slide a 2-by-4 horizontally into the opening. Hold it level, with its end against the next intact wall stud. Mark the 2-by-4 where it meets the sawed-off stud. Cut the board at the mark. Create three more pieces of blocking to fit at the top and bottom of the opening. To attach the blocking, apply construction adhesive on both ends of the piece of blocking. Place the board between the studs, flush with the drywall opening. Screw the piece of blocking to the intact stud using decking screws. Drive screws through the drywall and into the blocking to further secure the blocking. These screws will ultimately be covered by the face frame of the cabinet.
Fit the cabinet inside the blocked space. Press all the edges of its face frame flush against the wall. Drive drywall screws through the holes in the side of the cabinet and into the blocking. If necessary, caulk around the edges of the cabinet to hide irregularities in the wall.
Attach the wood frame mirror to the door hinges using the screws you saved when you removed the original cabinet door. Make sure not to bend the hinges. Open and close the new mirrored door to ensure that it opens and closes smoothly. Install the shelves and stock the cabinet.