If you use a K&N filter or any other cotton gauze filter that requires periodic cleaning and oiling you can contaminate the MAF sensor by over oiling. Even if you don't over oil it, there can be enought oil vapors in the incoming air stream to coat the MAF sensor wires with oil and throwing off the calibration of the sensor causing rough idle and irradic performance.
The sensor can be easily cleaned with electrical contact cleaner spray. Of course the sensor can fail and still need to be replaced, but cleaning is a good first step.
...Rich