well, it is an electrical/sensor problem.... sometimes sensors are bad but can stop acting bad for a while, i dont know if that makes sense but when my tps in my car started to go bad... the engine light would be on and my car idled starngly... sometimes it did and sometimes it didnt...
either way, good luck, and i hope your problem stays away for a while.