Let PA mean the Peano axioms, let Con(PA) mean that the Peano axioms are consistent, and let Incon(PA) mean that the Peano axioms are inconsistent.
Godel's 2nd Incompleteness Theorem says that Con(PA) is not a theorem of PA, unless PA is inconsistent. Now consider the following argument that Con(PA) is a theorem of PA:
(PA and Incon(PA)) implies Con(PA), since (PA and Incon(PA)) is a contradiction, and a contradiction implies anything.
(PA and Con(PA)) implies Con(PA), obviously.
Therefore, [(PA and Incon(PA)) or (PA and Con(PA))] implies Con(PA).
Then since PA is logically equivalent to [(PA and Incon(PA)) or (PA and Con(PA))], we can conclude that PA implies Con(PA).
Therefore, by Godel's 2nd Incompleteness Theorem, PA is inconsistent.
Where is the error? There has to be an error, or else all of mathematics is wrong.
The error is when you write
All that (PA and Incon(PA)) implies is that PA proves Con(PA) (if PA were inconsistent, would you really believe that therefore 0=1?); and this is true internally to PA as well. That is, PA proves $$(*)\quad\mbox{If I am inconsistent, then I prove Con(PA),}$$
but PA does not prove $$(**)\quad\mbox{If I am inconsistent, then Con(PA)}.$$
That is, PA does not know that it is sound: in general, for most sentences $\varphi$, PA does not prove "If PA proves $\varphi$ then $\varphi$ is true." In fact, by Lob's theorem the only sentences for which PA proves this are the ones which PA already proves to be true!
Note that by turning your argument around, you in fact prove:
Relatedly, in the same way that iterated consistency principles can be used to provide a hierarchy of extensions of PA, iterated soundness principles also provide such a hierarchy (although they are usually called reflection principles in this context). So not only does PA not prove its own soundness (even for $\Sigma^0_1$ sentences!), but it is so far from proving its own soundness that adding soundness principles to it can yield tons of additional strength.