Good question. First let’s look at why you had shoulder pain from the bleeding ulcer. Blood in the abdominal cavity can put pressure on the diaphragm. The diaphragm is a large muscle across the top of the abdominal cavity. It’s involved in breathing.
Since the diaphragm and the shoulder both have the same nerves, messages from either place go into the spinal cord and get sent to the brain. The nervous system can only tell what nerves delivered the message. It doesn’t have any way to tell if the nerve at the shoulder or at the diaphragm picked up the message. So it takes a guess and sends the message back out to one or the other.
In your case, it guessed wrong and you got shoulder pain. When the shoulder hurts, the muscles tighten up. This reduces blood flow to the area, which can cause the pain to get worse. Ultrasound is a form of heat. Any form of heat can relax the muscles and bring blood to the area. The blood washes away the build up of toxins and waste from the tense muscle tissue.
This is why the US worked at first. As the bleeding into your gut continued the pain got worse and the real problem was found.