Check for vacuum leaks in the engine bay (hissing sound or something similar).
Also clean the MAF sensor (as you say it looks like one of the filaments are toast).
From TSB,
P0171 - System Too Lean (Bank 1) The Adaptive Fuel Strategy continuously monitors fuel delivery hardware. The code is set when the adaptive fuel tables reach a rich calibrated limit.
Fuel System:
�· Contaminated fuel injectors
�· Low fuel pressure or running out of fuel (fuel pump, filter, fuel supply line restrictions)
�· Vapor recovery system (VMV)
Induction System:
�· MAF contamination
�· Air leaks between the MAF and throttle body
�· Vacuum leaks
�· PCV system concern
�· Improperly seated engine oil dipstick
EGR System:
�· Leaking gasket
�· Stuck EGR valve
�· Leaking diaphragm or EVR
Base Engine:
�· Exhaust leaks before or near the HO2S
�· Secondary air concern
Powertrain Control System:
�· PCM concern
Edit. MAF sensor
http://www.contour.org/mods/mods.php?s=howto&displayid=36
and
http://www.contour.org/ubbthreads/showflat.php?Cat=&Board=zetecmaint&Number=989728&page=&view=&sb=5&o=&fpart=1&vc=1
and
http://www.autozone.com/servlet/UiBroker?ForwardPage=/az/cds/en_us/0900823d/80/1b/cb/25/0900823d801bcb25.jsp