I am so sorry your little one is having trouble.
As a human also owned by shih-tzu's I can tell you that these guys are prone to both back and neck injuries. Often we see this pain radiate to the chest or stomach areas.
It is possible what you are seeing is due to an injury in the back or neck Injuries can happen rather quickly and often with out the owner knowing. Moving to quickly slipping when running rough play or something as simple as jumping on or off of furniture has been known to cause such injuries While this is more common in small breeds like Dachshund , shih-tzu's pugs, corgies, basset hounds etc it can occur in larger breeds.
Dogs that are overweight are more likely to have back problems than leaner dogs.
Some back injuries involve simple muscle soreness. However more serious problems such as , disc injury or degenerative disc disease, cervical disc disease may be the problem. This can cause extreme pain, loss of muscle control, nerve damage and paralysis. A dog that has suffered a disc injury may show some of the following symptoms yelping when handled, lethargy, shivering, whimpering, loss of appetite, trouble urinating or defecating, reluctance to climb steps, lay down, get up or jump, may be unable to move, paralysis of the front or back legs or limping may also be seen.
Read more here
Treatment will depend on the severity of the problem. Dogs with mild injuries may be treated with steroid injections anti-inflammatory medications and rest. Pain medication may also be needed Surgery may be recommended if the damage is severe and does not respond to other non evasive procedures.
He really should be seen by a vet in the morning until you can have him seen do not allow any jumping, running, playing. Prevent all walking if possible only up for potty breaks
It is also possible he has injured a rib if he hit something or was playing to rough.
If he is very painful and he is not on any medications then aspirin can be used short term. This is dosed at 5mgs per pound of body weight every 12 hours. If you are going to have him seen by the vet in the morning and you can keep him comfortable then I would suggest holding off on the aspirin as this can alter what medications your vet can give tomorrow.
I hope all goes well,please reply back if you have additional questions or concerns