Using a bit of common sense it is clear that killing a mosquito in this situation is not a serious misdemeanor (and hopefully our Dhamma/Dharma isn't divorced from common sense).
From what I understand intention is the key. Your prime intention was to avoid harm to your son, not to cause harm to the mosquito. Still you disregarded the mosquito's life in the process. That's where from what I can tell, the bad karma lies. But rather than agonizing over it and its results which we can't know, better simply to cultivate respect for all life.
This will surely yield good karmic fruits!
Mosquitos, simple as they may be, are alive, look for food, have babies, suffer in some ways and probably have rudimentary feelings. I found it useful to reflect how similar we are to all creatures and how we share this earth and its ecosystem.
For what it's worth I was in the same situation probably 4 years ago and it was my 3-year-old son (rather than Buddhist friends) who didn't let me live it down. So mosquitoes have since been trapped gently and released!