The Gemora says that if he purchased the animal from a Jew, he would certainly tell [whether the animal he had sold was a Bechor or not]. What would the din be by inheritance, where the yoresh does not know if the animal ever gave birth or not? How about in a case where he received it as a gift?
Excellent point. It would indeed seem from SHULCHAN ARUCH YD 316:6 that when the animal is inherited, it would remain a Safek Bechor. When the animal is received from another Jew as a gift, I cannot see why it would be judged differently from an animal received as a present. The giver would let the recipient know if it was a Bechor.
Be aware, though, that REMA does not rely on the seller informing the buyer that an animal is a Bechor. Following the opinion of Rabbenu Yonah (quited in the ROSH), he asserts that it is always a Safek Bechor