The whole thing was captured on Ring video.
The video shows the bear climb up and over the fence to the pen holding the two pigs, named Mary and Hammy.
The bear began to attack Mary, but she was able to push back against her much larger foe and then Hammy charged the bear and scared it across to the other side of the pen.
Get top local stories in Connecticut delivered to you every morning. Sign up for NBC Connecticut's News Headlines newsletter.
"I am very proud of them because Hammy, the little one especially, he’s afraid of his own shadow and the way he came charging out when he seen Mary tussling with the bear," said Rebecca Shaw, who owns the pigs. "He was like 'oh no, no way, get out.'"
After a few moments, the bear jumped out of the pen.