I'm gonna disagree with you here. The child does indeed pose a threat. The child, of course, is not at fault or culpable for the situation. Nevertheless, the threat is real. This is about the only situation I can think of where it is true, but one need not give up one's life in this type of situation.
Self-defense is legitimate.
SD
SD, the Catholic Church does not agree with you on this. Trust me. Look up anything you want about ectopic pregnancy, and it will clearly say the Church condemns the direct killing of unborn children.
A few examples:
http://www.geocities.com/seapadre_1999/ectopicpregnancy.html
http://www.geocities.com/paulntobin/abortion.html#3
"It is not licit, even for the gravest reasons to do evil so that good may follow there from, that is, to make into the object of a positive act of the will something which is intrinsically disordered, and hence unworthy of the human person, even when the intention is to safeguard or promote individual, family or social well being...directly willed and procured abortion, even if for therapeutic reasons [is] to be absolutely excluded." (Humanae Vitae)
All therapeutic abortion is immoral.