I think that it's time for Biblical storytelling!
It starts in Numbers 31, where Moses and the Israelites settle in a land area near the Midianites. The Midianites hate the Israelites and their monotheism. In fact they hate them so much that the Midianites take the time, the money, and the effort to send ten thousand, I repeat, ten thousand women to the Israelites for the specific purpose of seducing them, and then getting the horny men to pray to the pagan gods, which would make the Israelites fall out of favor with God, which is exactly what the Midianites want.
But God don't play that game. After a while, the turning away from God in favor of sex gets worse and worse. God tells Moses to end it all. He orders Moses to mount an attack on the Midianites to kill the guilty parties (the women and their husbands), and adopt their daughters and take care of them.
The little boys, however, are a different story. Boys take too much time and money, and adopting them would only cause Israel to starve. So God orders the Midianite boys be killed as well.
Now, Abraham pleaded that God spare Sodom and Gomorah, and Moses pleaded that God spare the Hebrews for turning to idolatry. So it only makes sense that Moses would plead that God try not kill these innocent children. I can picture Moses praying in his tent (keep in mind, this is a "what if" kind of play--it shouldn't be thought of as literal):
MOSES: Lord, this decision of killing the guilty Midianites is nessesary, but the killing of these children is so brutal. Is there any other way?
GOD: What I have commanded, I have commanded.
MOSES: But Lord, you commanded "thou shalt not kill", and the law shouldn't apply to these children who have done no wrong.
GOD: What would you suggest?
MOSES: We should spare them, Lord.
GOD: If you spare them, where will they go? With you? Would you starve yourself? Would you starve your nation's children to keep these boys alive? Or would you spare them and leave them at home? Leaving to think about their slaughtered mothers and fathers, with no means to live? On the first day they will cry for their mother's and fathers; on the tenth day they begin to starve and feel great pain; on the twentieth day, they will be unable to move, and then they will die. Do you think you can shield yourself from the world by ignoring the cries of others? Be still! For I am God!
Of course the conversation may never have taken place. My point is that God not only allowed, but
ordered the killing of the most innocent of human beings for one reason, and one reason only: to shorten their suffering.
For me, Numbers 31 leaves no reasonable doubt that God approves of mercy killing.