TL;DR
- The Development team has complete control of the Sprint Backlog during a Sprint and may well swap out the work as you have suggested.
- The Development team may not be bullied or coerced into taking the high priority work into the Sprint under any circumstances.
- The Development team should try very hard to accomplish the current Sprint Goal and any work order highly by the Product Owner
- The Product Owner has the final say about what work is accomplished in what order in the Product Backlog
- Scrum provides rules that prevent wasteful context switching and visionless changes mid-Sprint. It ultimately calls for the PO and Development team to act with respect, openness, commitment, focus and courage towards one another when forming a solution to your proposed situation.
This is ultimately a Development Team decision but it involves potentially everyone on the Scrum team. The Scrum guide specifies several rules to consider here:
No one [other than the Product Owner] is allowed to tell the Development Team to work from a different set of requirements, and the Development Team isn’t allowed to act on what anyone else says.
The Product Owner is the sole person responsible for...ordering the items in the Product Backlog to best achieve goals and missions...
For the Product Owner to succeed, the entire organization must respect his or her decisions.
The Sprint Goal is an objective set for the Sprint that can be met through the implementation of Product Backlog.
If the work turns out to be different than the Development Team expected, they collaborate with the Product Owner to negotiate the scope of Sprint Backlog within the Sprint.
As new work is required, the Development Team adds it to the Sprint Backlog.
Only the Development Team can change its Sprint Backlog during a Sprint.
During the Sprint: No changes are made that would endanger the Sprint Goal.
Great flexibility exists to incorporate new work within a Sprint so long as the Sprint goal is not threatened. Ultimately, this is the choice of the Development Team as they own the Sprint Backlog and may not be told to work on things the Product Owner has not ordered as work to be taken next.
Should a Product Owner deem it necessary to for the Development team to work a high priority task this may certainly be incorporated into the current Sprint but only by the Development team and only with full knowledge of the request. If the Sprint goal is threatened by such work, the Development team has the obligation to push back respectfully. They are also obliged to do whatever they can to negotiate regarding the Product Backlog Items in the Sprint so long as they still accomplish the Sprint goal even while incorporating the new work; however, the Sprint goal must not be sacrificed.
Ultimately, it's the Development team that must provide the answer to your question as Scrum does not prescribe any answer; however, Scrum establishes the Development team as a self-organizing group of professionals which must be trusted to have as their highest aim to delight the Product Owner. Likewise, Scrum defines the Product Owner as being the final arbiter of the order of work completed who's ultimate aim is to maximize the value in the Product and of the Development team's work. The answer requires that mutually respectful and at times courageous conversations take place between the PO and Development team with the Scrum Master facilitating this conversation as needed.