The basic structure of the mid back area contains the ribs, which are attached into the vertebrae in the back and into the sternum in the front. These ribs rest under the scapulae, at the meeting point of the ribs and the vertebrae there are nerves running up and down; as well, there are very small, very strong cross-hatched muscles that run inbetween each rib, to connect them and to coordinate their movement during breathing.
All these elements (bone, joint, muscle, nerve) are inter connected.
From what you describe of your symtpoms, it sounds like you pulled your ribs out, causing a strain in the muscles and closing down on the associated nerves. There are several approaches that should relieve this pain: one, take a medical ice pack and put it on the area that hurts the most, to bring down the irritation and swelling in the area. Two, practice deep breathing exercises, holding your breath for up to ten seconds and then a slow release; this may encourage the ribs to go back into place. Swimming may help as well.
While this will give you temporary relief, I highly recommend that you go to a Chiropractor in your area, who can check for underlying reasons that you are feeling this pain, and correct the mis-alignments.