My dog, a large sight hound, would love love love to eat our chickens, but every time he looked at them to begin with, I told him to leave it. It took about a week, but he is safe with them now.
Now, this dog started out with a solid "leave it". I'm talking, I can put a bloody beef steak in between his front paws, in a down/stay and tell him to leave it, go outside and come back 5 minutes later and he and the steak will still be there as I left them. He respects my ownership of resources, and so he respects the birds as being my "property" and won't even look at them now. You're starting from a different point in training, so getting him to leave your guinea pigs alone will take longer.
That being said, I would never in a million years leave him unsupervised with the birds. Prey drive can be tricky, and if something the birds did triggered it, and I wasn't there to intervene they would be dead in a hurry. He sees baby chicks as amazing peeping popcorn treats, and when I hold one around him he does backflips trying to figure out what he needs to do to earn it. However, he NEVER is pushy with me trying to demand it, even though it is something he wants more than anything else in the world. He is more interested in them than he is with female dogs in season, if that gives you an idea.
If the westie was my dog, I would tie him to my belt with a leash. This is going off your other thread where you say he is pooping in the house.
I would get some food he loves, since he isn't eating his kibble something like boiled shredded chicken would do, and keep a bag of it in my pocket. Every time he looked at me, paid attention, listened well, pooped outside, etc. I would reward him with a shred of chicken. This is to build his drive to work for you, attention, respect (since you are managing every resource) and also allows you to micromanage him so that he doesn't have a chance to be unsuccessful and poop in your house.
As for the guinea pigs, I would put them in a different room until he learns to pay better attention to you. Start by teaching him a solid "leave it" command. What that command means is "never, ever in 100,000,000 years will you EVER get THAT thing". Very different from "wait", which means "you can have that when I say so." Your dog sounds smart, so if the meaning of "leave it" has been tainted by allowing him to have something after he was told to "leave it", find another word. I don't care if it is "watermelon", as long as he has no previous associations to it.
When he gets good at it, start taking him near the guinea pig room. If he reacts say "eh eh" and lead him away. When he's calm, try again but not as close. His reward for being calm is being near them in this case. When he reacts, he is removed. When he can be calm, start rewarding him heavily as he ignores them. You might have to do this 100 or more times depending on the dog, how much he respects you at that point, and how driven he is to eat your piggies. No matter how good he gets around them, I would still never ever leave them alone in a room together, even with the pigs in cages. A determined terrier can do amazing and horrifying damage. Just ask some of our members.
A good game to play with him would be doggie zen. Hold a great treat in your open hand. He will rush over and try to take it. Just smile and close your hand so he can't. Don't correct him, don't talk to him. Just close your fingers. When he backs off, open your fingers again. When he rushes, close it. Don't keep your hand open until he is sitting quietly, not trying to get the treat.
Then give him the treat. This teaches him self control. That to get the treat, he must not
want the treat.
ETA: The suggestion to wear him out is great! Tired dogs are good dogs.