TL/DR: Peer reviewed literature is not doctrine. That a result contradicts "accepted truth" does not mean that it should not be published. All that matters is that the result be properly checked for errors. If there are no apparent errors, then let the academic community decide why there are two seemingly correct yet conflicting results.
If you find a result that contradicts existing thought, publish it. Whether or not a result contradicts standing thought should not affect its acceptance or rejection. Only the quality of the argument should have an impact. I say "should not" because it is sadly not always the case.
If you are not certain as to whether or not your conclusion is correct, find someone with whom you could discuss the matter and see if they agree. If you can find someone prominent with whom you can co-publish, and who can add to the argument to make it more robust, then you might want to look into that.
Automatically Wrong
There seems to be a bit of a suggestion that if it contradicts existing literature, it must be wrong. Now, I suppose in mathematics, it is usually relatively "simple" to verify a proof, but even then there can be errors. Make sure you know what you're talking about. Get some feedback. But do not assume that you are wrong because the current literature is against you. If this contradiction were in science rather than mathematics, even more the reason to not assume that you must be wrong.
Much of published literature, at least in science, overrides past literature. In science, we only assume that a theory is true, until we find evidence which contradicts it (Further discussion on the nature of science). Mathematical theory can be such evidence.
Again, if your thesis is well thought out, properly explained, and an expert in the field cannot find an error with your work, there is no reason to assume that your answer is wrong. Just because an existing answer is accepted by academia should not dissuade you.
Conflict Resolution
There has been a suggestion that before publishing the paper, it should be determined which position is correct. However, that might not be possible, or neither party may have an answer. Publishing a result, so long as it is not apparently flawed, allows the community of experts to become aware of the potential alternative and work on explaining the conflict. As a professor recently said, the main way in which experts in a field communicate is through peer review. To refrain from publishing because the question of whose position is correct has not been resolved would in some ways be withholding potentially useful information from the academic community.
Doctrine
David Richerby made an interesting case. He suggested that because the other theorem has already been accepted, it should now take additional effort to overturn it. However, there is nothing that seems to be wrong with either theorem (at least according to the OP). David's suggestion means that if the OP's proof were conceived and received first, and it were the other result that was later identified, somehow the burden of proof would switch and now it would require exceptional levels of justification to get that result published. In other words, the order in which the result was produced is the only thing that is changing, and yet somehow that change takes the OP's result from requiring extraordinary proof to requiring ordinary proof and takes the currently established result and demands that now it would need extraordinary proof.
When a result carries more weight, simply because it is already established as being "true" by a group of people, that result becomes doctrine. That is not how academia works. That is not how research works. The validity of a result, and the level of justification needed, is determined only by the result. So long as there are no apparent flaws, and the result has been reasonably checked for flaws, as all results for publication need to be, then the answer is obvious: publish and let the academic community work on resolving the conflict.
Dan Fox linked to a very interesting example. "In 1991, Kapranov and Voevodsky published a proof of a now famously false result." In 1998, someone came up with a contradictory result, but could not find the error in the original proof. Ignoring what would have been the apparent consensus advice of SE Academia, the result was published anyway. It was not until 2013 that an error was found in the original proof, and it might have taken a lot longer had Simpson not pushed the issue by publishing his own result.