Don't give up. It sounds to me like a freak accident. The only thing you could have done to prevent it (if it was mastitis) is to wean the piglets later, like 8 - 10 weeks. I've seen references to earlier weaning leading toward mastitis.
On the other hand, resistance to mastitis is at least partially hereditable, so removing an animal from your breeding stock (as unfortunate as it was) that gets it is actually good animal husbandry and ensures more problem-free breeding stock in the future. Pigs have had to endure so much the last century as far as adapting to confinement operations and less and less ability to use their natural instincts, that these days some pigs we want to pasture and raise naturally have lost too much and can't perform well. Not that we should give up, but we should be breeding for the traits that fit what we want to do with them, i.e. root/graze, have uncomplicated births, be able to live in a herd, etc.
If you read
Joel Salatin's work, he's in favor of stopping worming and medications just so you can see which animals are naturally resistant and then culling very hard to make sure those traits wind up in your offspring. Anything less will lead to more trouble down the road. Of
course, if it's a pet and you have an emotional attachment things may be different, but then you need to give good thought to whether you should be breeding some animals or just keeping them for your personal enjoyment (and pigs can make fine plows, cleaning crews, agritourism attractions, etc.).
I keep adding to my pig herd, and now that the numbers are up (to 7 - 3 adults and 4 weanlings), I'm surprised to see how well they enjoy each other's company (they all sleep in a big pig pile, and pushing at mealtime has stopped). It's a delight to watch animals living closer to what their natural instincts are, and the thought that our pork will come from these happy animals instead of ones confined to crates in stinky buildings being fed agricultural waste mechanically delivered to a trough is enough for me to keep going.