More than likely what you're seeing on his gums is normal pigment, especially if the black spots are flat...not a worry at all.
I wouldn't expect the wormer to cause balance issues. I've certainly seen this problem with the over the counter flea/tick products such as Sargeants and Hartz which is why I don't like them.
But the problem was present before you applied the flea products if I understand you correctly so these are not likely to be responsible for his behavior.
However, there are several other possible explanations for the symptoms you describe:
1. Idiopathic Vestibular Syndrome if his eyes are oscillating back and forth (or were moving side to side very rapidly...they might not be so bad now).
Idiopathic means we have no idea why some cats will develop this condition.
The balance is off and they are very uncoordinated; as strange as it sounds, they will recover from these episodes none the worse for wear after about 10-14 days.
If he's slowly improving, then this condition is possible.
2. We also see inner or middle ear infections that affect the balance, too; antibiotics would be needed for this condition before significant improvement is seen. Ear mites usually cause a cat to scratch their ears or shake their heads; these parasites don't affect the balance in most cases.
This LINK discusses vestibular disease which you may find helpful.
3. Viral diseases such as FIP. This is a particularly nasty disease that can cause neurologic signs and weight loss. He wouldn't be improving but would stay the same or possibly worsening. This is not always an easy diagnosis to make although proteins might be elevated in the blood.
Feline Leukemia or Feline AIDS can also cause these symptoms. A 10 minute blood test in your vet's office can be done for these diseases. AIDS isn't' necessarily a bad disease to have unless neurologic signs are developing but Leukemia carries a poorer prognosis.
4. Toxoplasmosis is a disease that can cause neurologic signs and weight loss and upper respiratory signs; this condition is transmitted by eating wildlife so this is possible for an outside cat. This LINK discusses this disease in detail.
Clindamycin is the treatment and most of these cats recover completely once antibiotics are started.
I'm not sure why his stomach is moving as you describe. Internal parasites don't usually cause this symptom; usually cats will have looser stools or possibly weight loss when they've picked up parasites. Certainly outside cats tend to lose weight as the summer progresses because they're so active but obviously the balance issue is somewhat concerning.
I hope this helps and gives you various possible explanations for the signs you're seeing as well as topics to discuss with your vet if he's seen. Deb