Subtraction of astrophysical foreground contamination from dirty sky maps produced by simulated measurements of the Murchison Widefield Array (MWA) has been performed by fitting a 3rd-order polynomial along the spectral dimension of each pixel in the data cubes. The simulations are the first to include the unavoidable instrumental effects of the frequency-dependent primary antenna beams and synthesized array beams. They recover the one-dimensional spherically-binned input redshifted 21 cm power spectrum to within approximately 1% over the scales probed most sensitively by the MWA (0.01 < k < 1 Mpc^-1) and demonstrate that realistic instrumental effects will not mask the EoR signal. We find that the weighting function used to produce the dirty sky maps from the gridded visibility measurements is important to the success of the technique. Uniform weighting of the visibility measurements produces the best results, whereas natural weighting significantly worsens the foreground subtraction by coupling structure in the density of the visibility measurements to spectral structure in the dirty sky map data cube. The extremely dense uv-coverage of the MWA was found to be advantageous for this technique and produced very good results on scales corresponding to |u| < 500 wavelengths in the uv-plane without any selective editing of the uv-coverage.