It's probably from your nose bleed, especially if the nose bled when you were lying down. Miscarriage does not cause a person to throw up blood. Bleeding with miscarriage comes from the vagina. Not in the mouth, not in the lungs.
Hiya I have kinda had some of the same things, remember dark blood brown blood is old blood, also basically I had a cold and my nose bleeds alot too I never was sick but I spat out blood id go to docs they had to test me for blood clot on the lung thankfully it came bk negative! But my baby is fine kicking away and heartbeating fine so i dont thinm it would mean miscarriage but im not a doctor id get checked out x