Your pain could well be muscular, such as a strained muscle or ligament or even a fractured rib. It could also be nerve root pain due to a collapsed vertebra or a herniated disc and the fact that your pain, as described, does follow the course of a couple intercostal nerves, which are located between the ribs.
However such pain could also result from a collapsed lung. If you are still experiencing the pain, especially if it is undiminished, at the time you read this response, you should definitely seek medical attention, without delay.
Good luck.
I'm not a doctor of course, but my sister-in-law had something similar and she was diagnosed with pluresy. Maybe go see your doctor? Good luck!