It could be your stomach or lungs. i dont think your baby is in any harm. I'm almost positive its your lungs.
It wouldn't be as high as your ribs if it was ectopic. It's possible you just pulled a muscle or you were laying funny on it in your sleep. If you're concerned then call your doc, or out of hours and see if someone will examine you.