Disconnecting the battery would be a start - negative battery terminal off for a minute - might help to step on the brake or flip on the headlamps to drain any residual charge. Some cars cannot be reset in this manner - have to be reset with an OBD-II scanner. This is more likely in cases where CAN bus is being used - like in your model year Corolla. Keep in mind that anything that depends on power will also be affected - radio presets, some headunits have builtin security, alarm systems, etc. If in doubt - just pickup a CAN compliant OBD-II scanner at an autoparts store. They are really getting inexpensive and just pulling and reseting a single CEL - it will pay for itself (Toyota dealership's typically charge around $85 for a diagnostic fee).
The little bulb thing is the IAT sensor (intake air sensor) - the MAF sensor itself is inside the plastic cylinder MAF housing (should be able to make out two "wires" on the inside of the tube). Backprobing the sensor - you should see a rise in voltage as more air flows over those MAF sensor - so as you increase the throttle - the voltage will increase from the MAF. Same with the O2 sensors, you should be able to see the voltage trace (o-scope is best here) and view the waveform in real-time. Yours will be a little different than conventional O2 sensors, as the 2005+ Corolla models now use an air/fuel ratio sensor instead of an O2 sensor. The sensor is much more sensitive and has a wider sensing band. In other words, the new sensor acts more like a wide-band O2 sensor (read expensive) compared to the garden variety narrow-band O2 sensor.
The after cat O2 sensor on the car may flag a code if the heater circuit malfunctions, but generally not considered an issue for a P0171. The only job the rear O2 sensor does is monitor how effectively the catalytic converter is doing its job. The air/fuel mix is determined by the upstream or pre-cat sensor.
My suspicion is that once the CEL is reset and the MAF was cleaned carefully - the code should drop away, no more CEL.