There are a lot of cases where animals do some pretty incredible stuff for their owners. It is not just pigs though. So to say pigs are the smartest animals are a bit of a jump of the gun. All animals have intelligence and they have the ability to do whatever they need to do.
Each species has its own differences. We can all do amazing things. And no, just because I say pigs aren't the smartest doesn't mean I'm trying to say that humans are. Not even CLOSE. We are just as smart as them, and they are just as smart as us. Ants will lock arms and legs during a flood and form a raft to save their queen. Chimps, and many other animals have better memory than we do. These are two of MILLIONS of examples that humans aren't special in any way, except for our ability to find pleasure in murder.
Even though humans might be separated from the animal world, they are still animals. A human of average intelligence would typically be viewed as smarter than a pig. Complexity of language can be one trait that distinguishes intelligence in animals, as well as manipulation and interaction with their environment. Under those parameters, humans, other primates and dolphins would generally be regarded as more intelligent than a pig.
While pigs are very intelligent, they are not the smartest animals. I believe that aside from humans, crows are the smartest animals. They fashion their own tools and use them to build nests or obtain prey. Crows have impressive memories, even being able to recall faces of enemies that they may have only seen once. Then, upon meeting an enemy, crows spread that information to other crows, who then also recognize the enemy based off of the information, so that they may also be wary of that enemy.
I feel that there are some animals that have a greater brain capacity than pigs. There are many animals that are capable of recognizing human speech and responding to it. Some monkeys, for example, can learn sign language and use it to communicate with humans. Cats, dogs, and dolphins can all be trained and take commands from humans. I do not believe this is within a pig's abilities.