Strictly speaking, you are immediately out of status. However, USCIS knows about layoffs and was kinda turning a blind eye in 2002/2003 and approving transfers. It doesn't hurt to attempt a transfer *ASAP*. At the worst, they'll approve the case as a new (not transfer) H-1B, but deny the transfer and refer the case to the corresponding consulate. However, the cap for this year has been filled so I'm not sure what will really happen. In such an event, I'm *optimistic* that USCIS will indeed approve the transfer.
Also check if your terminating employer is planning to inform USCIS about your termination. The smaller employers are apparently not required to do so. If you delay, you might not have a recent pay stub to attach with your transfer application. With a new application (new H-1B, now not possible due to cap exhaustion) this is normally not an issue.
Good luck and let us know what happens. More importantly check with an attorney. Also be aware of the 180 days 3 years bar and 180 days 10 years bar rules.