There can be tons of reasons...
Without seeing the code together with the actual execution plan of the code section in question for both cases (fast and slow) it'll be just guessing.
My pot shot would be a locking/blocking condition or bad statistics.