In U.S. practice, double jeopardy protections attach once the jury is seated and this scenario contemplates the change in position arising at trial.
A mistrial could be called, or a continuance obtained, if the defendant suddenly claimed an alibi defense, since that amounts of a defendant waiver of double jeopardy protections. But without proof that the witness was tampered with, obtained at the last moment, it can be difficult or impossible to get proof of tampering or to contradict the story with other evidence to undermine the credibility of the witness.
The prosecution would probably request a recess in the trial to regroup and try to admit evidence that the testimony changing witness made a prior inconsistent statement to impeach the testimony of that witness, from whomever that witness told the first time (probably a law enforcement officer). But this is still far less convincing to a jury than an affirmative statement from a witnesses about a key fact.
If the prosecution could find evidence of defense side tampering and present it to the judge in the hours or small number of days before the trial ends, it might be able to get a mistrial declared. But it is much harder to get a mistrial for witness tampering when the witness shows up and testifies contrary to prosecution expectations than it is when the witness is, for example, killed or kidnapped and doesn't appear to testify at trial at all.
But if evidence of neither type could be obtained before the jury was sent to deliberate and evidence was closed, and the jury then acquitted the defendant, it would be very hard for the prosecution to change this result. Perhaps not completely impossible, but very nearly so.
The witness could be (and in this circumstance, despite the extreme rarity of perjury prosecutions, probably would be) prosecuted for perjury, but that wouldn't change the acquittal.
If a link to the defendant could be found, the defendant could also be prosecuted for witness tampering or obstruction of justice or something similar. But that is hard to prove (and the witness would probably have to be convicted or provided with use immunity for his testimony) to do so.
In English criminal law practice, in contrast, the likelihood of having the verdict of acquittal set aside and getting a new trial would be much greater (and the likelihood of getting a recess mid-trial would be greater in far more common bench trials in lower level criminal cases), but it would still be a serious burden for the prosecution that it might not be able to overcome.
Lawyers aren't entitled to expect that witnesses will testify exactly the way that they discussed things with the lawyers before trial, and this can be explained away with a variety of excuses that are usually true ("after thinking it over after meeting with you, I realized that I was confused and getting it wrong"), but are sometimes a cover for a change of story that is not sincere.
I've had similar things happen a few times in civil litigation and there is only so much you can do about it.