Serious error in published journal paper by a faculty member Consider the following scenario:
Paper A used a model developed in Paper B.
This model developed in Paper B was corrected over the years in an erratum before Paper A was published.
This makes the outcome of Paper A invalid.
Paper A is published by a faculty member in the department you study as a research student.

Questions:
1) Do I contact this professor with this problem?
2) Do I go ahead and submit paper based on the corrected model in Paper B, which calls for a slightly different methodology hence different results, and stating that Paper A published earlier by the professor is wrong?
3) If 1) is the case, how do you ensure the professor would retract the paper or even include you as a coauthor in an erratum?
Initially the question read in a way that the answer was obviously "this is how science works, no need to make a big deal, just do your project."  It was then clarified that the errata to paper B was published before paper A.  Which makes things a bit more complicated.  Here are some thoughts on the matter.

It's all about the timing

Possibly the timing of the review process and publication for A as well as those for the errata to B made it essentially impossible for A to be aware of the errata and to take it into account. This should probably be your default assumption going forward until you have solid evidence to the contrary.  In this case, the answer is "This is how science (and peer review) works, no need to make a big deal; ideas and methods get updated and discarded for newer ones all the time".

At some impossible to define threshold, though, when the errata for B appears sufficiently long before A, then we have a clearer problem: A should have known about the erratum, and failure to be aware of it constitutes a deficit and failure in the research for paper A.  Unless you have compelling and clear evidence that this was actually done intentionally by A's researchers (e.g. "We don't have the funding to fix it, so we'll pretend it doesn't exist and hope the reviewers don't notice", or "The erratum to B undercuts our research program and beliefs, so we will ignore it in order to minimize the damage to ourselves"), you should still not make a big deal of this.  You should point it out (in the prior case, as well), but do so dispassionately and "scientifically".  Don't denigrate or insult the researchers, simply point out the flaw, cite the erratum and possibly other relevant works that make this flaw clear, and then put it behind you and write the rest of your paper as independently of it as you can.

The worst case scenario

If you have compelling evidence that the failure to account for the erratum to B is because of unethical research practices, or fits into a long running pattern of such omissions/mistakes, then you've got a potentially serious problem.  Consult with your advisor, but avoid getting emotional and personal about it.  They might have more information and perspective that you are lacking that might paint a less negative picture. If your advisor echoes your concerns, then they may know what steps to take next and may take them for you (assuming they have tenure, they have a lot more job security than you do).  Your university should have an ombudsman or other person or office that is specifically concerned with the monitoring and enforcing of ethical research, and this is who you would go to if you feel you still need to take action.  From there you could conceivably elevate things to the deans, but this is a very severe action with no guarantees the dean(s) will side with you, and even if there are legal protections for you in this situation you may still find your career negatively influenced.  You may wish to consult with a legal professional before going to the deans (possibly even before going to an ombudsman).