Definatly go to a rescue. In the petshop it's not just the conditions they are kept in, but the conditions in which petshop stock are often bred from. They'll come from small animal farms, where breeding animals are kept in horrible conditions, sows will be over bred from having back to back litters, and when they're too sick to breed anymore they'll be killed (and not always humanely.) They will also cull babies with defects that would make them difficult to sell, and due to inbreeding and poor conditions, petshop animals often have problems with poor health, and shorter life spans.
By buying from petshops you're not only saying that this sort of breeding is ok, but you're also telling the petshop that keeping the piggies in the wrong conditions is ok as well. While you will be making things better for the one piggy you get from the petshop, you're allowing another poor piggy to be put into the exact same situation.
It's only by not buying livestock from petshops that we can stop petshops actually selling livestock.
You can't "rescue" from petshops, as it is a vicisious cycle. Rescue should really not involve any money changing hands. (A token dontation is different, however.)