While a foreign national may have violated his/her H1b status, he would not necessarily accrue unlawful presence. The H1b is very unique in that it allows for many exceptions that do not apply to other visas. While you would not be able to change status in the U.S., you could apply for the visa at the U.S. Consulate in your home country (which is what it appears you did).
You must speak with an experienced immigration attorney regarding the specifics of your case, including the length of time you stayed in the U.S. beyond your last day with your former employer, the validity dates of your previous I-94, and whether or not you worked in the U.S. while you were waiting for the approval of your second H1b visa application.
Please do not hesitate to contact me for any clarifications needed.
Renata Calderaro, Esq.
The Calderaro Law Group
12550 Biscayne Blvd., Ste. 800
Miami, Florida 33181
Follow us on Twitter: RenataCalderaro