Maybe Baby - S7-E11
Corrected entry: Roseanne has an amnio and they think something is wrong with the baby so they have a second one which turns out fine. The doctor reveals that it's a girl but then later, she has a baby boy, Jerry. The only way he could have been wrong would be if maternal cells were tested instead of fetal cells.
Correction: According to about.com the amniocentesis is only 99% accurate, infact, my own son was identified as a girl from the amniocentesis. It is rare but it happens.