Rashi on the pasuk of לא תסור מן הדבר אשר יגידו לך ימין ושמאל quotes the famous sifri that even if the Rabbis tell you that the right is the left and left is the right you are required to listen. The implication is that even if the sanhedrin would be matir something that you know is assur, you should listen to them. This concept seems to be supported by the story between R. Gamliel and R. Yehoshua in the mishna in Rosh Hashana regarding the calculation of Yom Kippur, where R. Yehoshua was required to violate Y.K. This seems to contradict the gemara which says that when a talmid knows that the beis din is making a mistake yet follows their ruling to eat cheilev, it would constitute an intentional violation. The case of the mishna which says that you would bring a korban for shogeig would only apply if the talmid thought that this was included in the mitzvah to listen to the chachamim. The gemara is clearly saying that those who follow the leniency of the beis din even though they know it is wrong but are making a mistake in thinking that one is supposed to follow the chachamim even when they are wrong, brings a korban for this violation. The gemara holds that one cannot follow the Rabbis when they tell you the left is the right!?
The Maharatz Chiyus points to the Ramban in sefer hamitzvos who says that a person who thinks the sanhedrin is making a mistake because they don't have the information that he has, or because they forgot a din, is not allowed to blindly follow their pesak. Rather, he is obligated to discuss it with them and make them aware of the information that he has. Only after he discusses it with them and they refute his points do we completely reject his opinion to the point where he should follow them even if in his opinion they are still making a mistake. The Rashash also makes this point. R. Elchonon Wasserman (kunteros divrei sofrim 4:9) explains that the Ramban holds that when sanhedrin issues a "hora'ah", one is required to listen even if their judgement is faulty. But if they are making a mistake due to inaccurate information so that their pesak is a ta'os (mistake) rather than a hora'ah, one should not listen to them.
R. Elchonon (13) offers another approach to answer the question between our gemara and the sifri. Perhaps the sifri entitles chachamim to authorize a pesak that is against the torah - אפילו על ימין שהוא שמאל, but only if they make it clear that this is their takana and not the din torah. This would be as the Rambam writes in hilchos mamrim that the chachamim can forbid chicken and milk so long as they don't claim that it's from the torah itself. But, if the chachamim are making a mistake, there is no concept of "da'as torah" to follow their mistake. R. Elchonon suggests that this d'rasha of the sifri may be the source for the opinion יש כח ביד חכמים לעקור דבר מן התורה.
Clearly, one would not have to follow the p'sak of a Rav who they know is making a mistake because he is basing his p'sak in a medical or scientific related shayla on inaccurate facts or is not aware of an integral source in halacha. However, people who have a tendency to reject "da'as torah" because they feel that they know the science better, are often missing the torah knowledge to pasken appropriately. B'kitzur, without a good knowledge of both the facts (or science) AND the Torah, the p'sak wouldn't qualify as a "ho'ra'ah", but as a "ta'os", and it would be forbidden to follow it.