Your problem sounds familiar. I have a 2005 Toyota Corolla that began having problems in Jan 2007. The problems started when the weather got cold, and the problem disappeared in the spring. A summary of the complaints, diagnoses, and attempts at repair are summarized below. As you will see, the dealership made a number of attempts to repair the problem. It appeared as if the problem was solved. However, a couple of months ago, when the weather got cold again, the problem reappeared -- Same symptoms. I haven't taken the car in to get repaired yet, mainly because I have lost faith in this problem getting repaired correctly. Interestingly, I noticed today a newly posted service bulletin: "M. I. L. (ON) DTC P0171, P030# AND/OR P0133 ENGINE RUNNING LEAN IN SUBFREEZING AMBIENT TEMPERATURES", that was released last month. I don't have access to the full service bulletin (though I would greatly appreciate if anyone could share it!), but I'm wondering if it could expain the timing of the appearance of the problem that I experienced, and if it could be relevant for the problem you are experiencing now. Just a thought. I would like to see what other people think about this.
1/05/07
COMPLAINT: Check engine light
found code p0171 test drove 21 miles if returns will need further testing
1/23/07
COMPLAINT: Check engine light
found code p0171 fule system lean ordered mass air flow sensor
1/30/07
Corrected by 895161: (8A (73) volume air flow meter r&r
Installed 22204-0D030: Meter sub-assy, inta Qty: 1
P0171 airflow sensor failure replaced mass air flow sensor and cleared light
2/06/07
COMPLAINT: Customer states that the veh runs rough and shakes when engine is cold when
idling
Test drove veh after it sat overnight no codes no TSB could not duplicate concern at this
time adivsed customer of no concern present at this time. Test drove veh three times
throughout the day.
2/19/07
COMPLAINT: Check engine light
Ordered: 89661-02k20: Computer, engine con Qty:1
Ordered new ecu underwarranty per tsb EG006-05 had code p0171 in system will call
customer when part arrives
3/05/07
Corrected by 895011: (8a) (74) engine control module r&r
Installed 89661-02K20: computer, engine con Qty: 1
Removed and replaced engine control module due to code p0171 cleared check engine light
and test drove
No further concerns noted at this time
3/08/07
COMPLAINT: Check engine light
Ordered: 90430-12005: Gasket Qty: 1
Ordered: 89422-35010: Sensor, water temp 8942 Qty: 1
Ordered new coolant temp sensor
3/14/07
Corrected by 895131: (8a) (71) Oxygen sensor (ONE) r&r
Installed 89422-35010: Sensor, water temper Qty: 1
Installed 90430-12005: Gasket Qty: 1
Performed diagnostic test found cod p0171 removed and replaced coolant tempt sensor no
further concerns noted at this time
4/09/07
COMPLAINT: Car shakes and stutters at stop lights, especially after initial start up
Ordered 8946-12010: Sensor, air fule rat
Ordered A/F sensor under TSB EG051-05 due to failure code P0171
4/13/07
Corrected by 895131: (8a) (71) oxygen sensor (one) r&r
Installed 89467-12010: Sensor, air fuel rat Qty: 1
performed TSB EG051-05 per code p0171 fuel system too lean, after performing active test
of o2 sensor and A/F sensor found AF sensor causing fule trim to be out of range no
further concerns noted