I had a similar thing a while back. It was todo with my database query taking a really really long time. Play about with this. If I was you, I would try putting this in many places throughout your script and setting it really really small, something like 4 to 5 seconds. It may be that it's waiting for something to happen. By putting the set_time_limit on, it will stop and give an error on the line that is taking to long.
Another way of doing this, which might be better as a start, is to put this line right at the top and set it to about 10ish. This will give you a general overview of where things are taking time.
side note: On my computer it takes about twice the time that is set for it to trigger the error. But it does come up.