Say that there was a question concerning Shariah law brought about in the 8th century AD. Every scholar rules that the law follows by the opinion, X. However, today we find a lost manuscript, a hadith that says that the law actually follows the opinion of Y. As a Muslim, which are you required to follow: The opinion X (which was the consensus) or the opinion Y (which is what the old hadith says)?
A hadith is only taken into consideration when deciding upon a ruling when it comes with a solid chain. In this case, a long-lost manuscript will have no chain whatsoever. There is no way to establish that the last person in the isnad mentioned in the manuscript actually wrote it. So in a sense, the question is moot. It's not going to happen.
Now, if one assumes for the sake of argument that it was somehow possible to definitively establish the chain for this hadith and it went back to the Prophet (saws), you will still be split as to what to do with this hadith. The traditionalists who insist on sticking to a particular madh-hab no matter what will most likely not accept this hadith or the new ruling because it is not coming from within their tradition. They will err on the side of caution and established tradition rather than going out on a limb for this "new" discovery. The scholars who are less attached to singular madhahib and seek the strongest sunnah in any particular matter may consider this hadith, but it's doubtful, again because it's just safer to stick to well-established tradition.
If a situation like this did occur, the hadith must be looked at to see if it's authentic.
If the hadith is proven to be authentic, then it's taken and applied despite what scholars have ruled.
The hadith takes precedence, because it's considered part of our religion.
Scholars, their sayings, and their consensus are not religion.
In fact, consensus is something that was never part of Islam, it was actually added by scholars themselves despite there being no Quranic backing.
Scholars, their sayings, and their consensus (ijtehad) is not religion. They are to be taken as "good advice". It was done by the scholars in the situations, where they thought, no direct instruction is found from the Prophet (PBUH) himself.
If later on, such a direct instruction is found, and you are convinced that it is from Prophet (PBUH) and it is relevant to the same matter for which some scholar has given his opinion, then, as a muslim, it is your duty to follow what the Prophet (PBUH) has said.
There is no sanction in Quran and Hadith that anything can be added in the religion by any consensus. In fact, it goes against when [Allah says in Quran]
This day I have perfected for you your religion and completed My favor upon you and have approved for you Islam as religion.
Also, not all hadiths were collected and compiled in the time of our four great scholars. So it is possible that some hadith did not reached a scholar and he gave his opinion about it. Later on, people found out that there is a saying of Prophet (PBUH) about that matter.
One of these scholar has himself instructed that "if you find anything said by me against Quran and Sunnah, then smack it against the wall" (loosely translated)