Mine did this, I dont know what engine you have but i did it on a 1.4L AEX engine.
What i did was run the engine, then pull off the brake servo pipe coming from the throttle body/manifold the revs went high and it tryes to stall etc.. then pop it back on and it was fine ever since. Not sure of the cause but it worked for me.. Or disconnect the battery for 10 mins and reconnect. It will then relearn all the engien settings etc..