It sounds like his penis may be stuck in the out position and possibly causing him pain since shivering is a symptom of pain. This sometimes happens to male dogs. It may be due to the bulbous glands in the penis swelling outside of the outer skin (prepuce). This makes it hard for the penis to return to its normal position inside the prepuce. Or the hairs of the prepuce may have become caught preventing its retraction. This can cause problems if it is not corrected. You can try putting a little lubrication on the penis such as KY jelly and gently roll the prepuce back and forth and see if the penis will return to it’s normal position.
You can also make a saturated solution of sugar water using warm water. Mix the sugar into hot water until some sugar is left after mixing. Take a hand towel and soak it well and place it on the exposed penis. Be sure it is not too hot. This will sometime draw the fluid out of the bulbous gland and reduce the swelling allowing the penis to retract.
If the penis stays erect and will not retract using above methods, you should have him seen by the vet. The vet may have to put the dog under anesthetize to lubricate and return the penis to it’s normal position.
While the trembling is probably related to pain, I'm going to give you further information on causes of trembling. Shaking or trembling in toy breeds could be due to hypoglycemia, liver shunt, or a neurologic response such as a seizure. Trembling can also be a sign of pain, stress and cold.
Hypoglycemia is low blood sugar and frequently causing trembling in small breeds. Feeding your dog smaller meals more frequently can help. If you suspect your dog is having low blood sugar you can put a drop of pancake syrup on your dog's tongue which should raise the level.
A liver shunt is usually a genetic condition. It is a condition where instead of the blood going through the liver and being cleansed, part of the blood is diverted around the liver resulting in a toxic buildup in the blood. You can read about these here: http://www.malteseonly.com/shunt2.html
Seizures can manifest as trembling and a dog may not lose conscienceness. You can read more about seizures here: http://www.marvistavet.com/html/body_seizure_disorder.html
I hope this information is helpful to you.