It's happened to me twice. The first time, I was caught completely by surprise (although I shouldn't have been - I was working for a dotcom and it was 2002). The second time, I saw the writing on the wall a couple of months ahead of time, and launched my job hunt. By my last day, I was well into the interview process with the company I currently work for, so I was only out of work for a few weeks.
I hope you find something new soon. Keep your skills up to date, and don't give up.