Offers for programmers don't expire, unless someone magically made a bunch of new programmers overnight.
And to avoid the situation described in the first paragraph, you get the counteroffer in writing, of course. I know people that ended up doing 2 to 3 iterations of counteroffers. It worked out fine for them.
It depends on the level of programmers we're talking about. I agree that offers for the likes of Steve Jegge don't expire, but ones for "VisualStudio Joe" certainly do, at least outside the Valley.
To clarify, by "expiring" I mean the company finding another suitable candidate.
And to avoid the situation described in the first paragraph, you get the counteroffer in writing, of course. I know people that ended up doing 2 to 3 iterations of counteroffers. It worked out fine for them.