If they knew the gender it was more likely to be a stillbirth than a miscarriage.
As a mother of a stillborn child, and as a psychologist, I've been interested in research on the trauma involved, but have found only a few medical papers and no serious empirical work in psychology. There is some grief literature but a lot of the accent is on 'everyone grieves differently', whereas my impression is that the trauma involved leads to quite a decisive set of commonalities among the bereaved. But I have never seen a professional, empirically informed description of these commonalities in the case of early child loss.
The next child is a big theme in the bereaved parents community (they call them 'rainbow babies', in case you want to Google). One thing I've heard from a neonatologist working with parents in this situation, is that anxiety about the next baby is usually very high, even after birth, even when everything is clearly all right. It seems to take several years to get back to baseline (even in the absence of another child).
Sorry for the anecdotal reply, I wish I had some empirical articles to back my observations. The overarching belief used to be that stillbirth is something a women can get over easily, and that it's best if the baby is not mentioned by anybody. This used to be the medical approach a few decades back, and it is only now that parents (usually mothers) are speaking up, doctors are listening, and the psychological profession yet has to follow in a serious way.
I think your best chance of catching some new research is by following perinatal ptsd research. Perhaps the old school psychoanalysts have had thoughts about this as well, but I haven't come across them.
Hopefully someone will prove me wrong and give you an answer with proper references.