You should certainly have all your paperwork ready to take to an immigration lawyer specializing in employment cases. This is probably going to cost you several thousand dollars - sorry.

If you don't already have one because your current employer took care of that when you came, then hire one - even if you keep your current job, you should not assume the matter is resolved. Even if your current employer says they'll take care of the paperwork (or that no problem exists because you had not left before this happened), you triggered the situation and it's your visa which may be affected, so it's ultimately your responsibility to make sure it's cleared up. Your employer's attorney is paid to think about your employer's legal position, and may not be current or even conversant with handling such cases for individual immigrants.

Start looking for an attorney with the American Immigration Lawyer's Association, and talk to a few before you commit to an appointment - ensure they have experience in this area, and consider asking for references. You should also check with your employer about who their attorneys are, if only to avoid an accidental conflict of interest if they use an outside firm and you happen to call the same one! http://www.ailalawyer.com/

Technically your authorization to stay expires the day after you leave your current employer, although it may take months to process the paperwork. If they will take you back, that would of course be the best outcome. Put your request in the form of a letter and keep a copy for yourself. It should probably state honest credible reasons why you wanted to develop your career elsewhere (beyond mere $$$), and obviously it should be respectful and acknowledge what they've done for you in the past. Again, your attorney may have valuable input. Even if your boss senses something in your body language and asks you, then says you'd be welcome back, tell him you'd like to make a formal written request - much better to generate paperwork now which an immigration administrator can examine and approve at some future date, than to have a confusing absence of paperwork about the situation if your employer's records are inspected in the future.

As the company that let you down was smaller, it is possible they did not have experience with the immigration paperwork, and backed out for that reason - the rules are complex and are adjusted frequently. Do find out if they have already filed anything on your behalf or not. It might actually make your life simpler if they haven't, because generally the responsibility to straighten out any administrative oddities is yours, not the government's. Sometimes I read of people being placed in removal proceedings because of trivial errors or contradictions in their file that were not noticed or acted on until years later. There's no certainty of the HR manager or even the company in the Bay Area still being around in the future, so an abandoned or canceled application might come back to haunt you long after the firm had forgotten the whole episode. Whether paperwork was filed or not, get the answer from the Bay Area company in writing - indeed, it may be better to let the immigration attorney do that for you, since s/he will know exactly what information to request/confirm.

If your existing employer decides not to take you back, you may be able to file for a temporary extension of your visa called an I-539 because of the unusual circumstances, which will cost at least $300 in filing fees. Again, you need to consult an attorney who specializes in this area, who might suggest a quite different strategy. I mention it only as an obvious possibility - do not rely on this information!

I'm not an attorney, let alone an immigration attorney, nor am I qualified to give you any kind of legal advice. I just want to explain why it is so important for you to get professional help even though it will cost you some money.

Immigration matters have the potential to cause problems for you or a family member in unexpected ways because immigration law is complex and the usual assumptions about rights and obligations do not apply - your legal relationship with the US govt. as a non-citizen is entirely different from that of a citizen. A regular employment attorney is not a good choice, and they would likely refer you to an immigration attorney anyway - at least, they should.

Also, the internet is a very poor source of information not just on legal matters in general, but immigration in particular - some people with a dislike of immigrants hang out on Q&A websites to give out deliberately misleading advice or abuse people who ask. After spending a good part of this summer in a law library, I'm horrified at how much misinformation is floating about. Hire a pro - much cheaper to fix it now than later.

Sort out the immigration end first, and worry about recovering damages later.