Dear GCRejected...
yours was a case of denial due to a mixup of i140, where an amendment to the i140 was filed. i can't recall if your i140 amendment was approved or not. if it has been approved, get your lawyer to file another i485 on its basis ASAP, since the old i485 is closed. this should get you back in status. your lawyer might also pursue, in ADDITION TO ABOVE, the option of reopening the old i485 by substituting the old i140 with the newly amended one; if successful, then the new i485 could be withdrawn.
that still leaves the question of your current status. if you have been working on H1B, then that status is intact, and you have nothing to worry about. if you were working on EAD, then your are out of status. however, there is still ways to address that: if you search for applicable laws, then you will find that one of the reasons for any out of status time that had accrued can be forgiven is if that accrual was due to a mistake on the part of the INS/BCIS; but your lawyer has to make a case for that once that question comes up.
the other option, if your H1B is not valid, could be to file your new i485 under 245[k] (NOT 245): this is for smaller violations of status (less than 180 days), and does not have any cutoff dates (like 245 does). will set you back $1,000, but that is insignificant now, given the circumstances. while it is true that your out of status time, if any, is due to INS's blunder, but it might still be worth your while to buy some protection first, (in the form of 245[k]), then go about proving that it was not your fault in the first place, or have your old i485 reinstated.
please discuss these options with your lawyer first. it might be a good idea to also get a second opinion from another lawyer, especially if you think that your current lawyer is not quite up to par for this course. in any case, in cases such as i485 denials, PLEASE employ the services of a good lawyer. don't try to handle it yourself. that is the sincerest advice i, or anyone else, could give you.
we all wish you the best of luck!