Pull the ecm wiring harness off and check your connections for corrosion from the water/moisture...Yes, it could cause erratic idling/running, especially if your ecm is damaged from the water/moisture...
Also, check around the heater box for leaks and check your front windshield for leaks...Fix these before you fix/replace your ecm or clean connections or you will end up having the same problems again...