I know , is a rare case! A friend I know has the same case. He came with tourist visa and before his visa expires (6 month entry) he submitted his papers and did AOS. He already received his social security and work permit. The visa bulletin for our home country is C= Current.
if you are green card holder and your husband or wife overstayed the green card holder can’t help! But if you submit papers before overstaying and the visa bulletins for your home country is available you can do AOS.