I would also say that it could be your rib out of place too in which a chiropractor can help. Mine has been out for a few days now and it's very uncomfortable.
Definitely ask your doctor...rib pain can actually be an early sign of preeclampsia, so you always want to mention if you feel like it's extreme, especially if it's hurting bad enough to keeping you from sleep! But yeah they can definitely bruise your ribs and it hurts like heck...good luck hon, ask your doctor as soon as you get a chance.
Sounds like the baby could have bruised your rib. I'm 27 weeks and I always feel mine up around there kicking. I would check with your doctor to see if maybe they can bind it or give you anything to help. :( I'm sorry you are in pain. Ah the joys of pregnancy!