I spent 5 years doing my PhD research (4 years experiments, and one year writing the manuscript, making the figures and getting it revised and submitted by the supervisor. We submitted the paper (I was the first author) which is rejected with a recommendation for one more experiment, and resubmission. Three colleagues did it, as my scholarship was ended and as I was busy writing the thesis. I was shocked that the supervisor (PI) put one colleague instead of me as a first author, who just carried out this last experiment with help of two other colleagues (were added as co-authors). That colleague was busy doing her own project and did not do that much to my project except for that last experiment and revising the manuscript and giving some comments for correction. I refused the new order, though the paper was sent to the journal. How could I get my first authorship?
Unfortunately there is not much you can do -- you can try to get the editor of the journal involved, but it is almost certain that the editor will not involve themselves in authorship disputes that have nothing to do with the scientific content of the paper. Also there is a high chance of severe damage to your relationship with your advisor, which needless to say is not ideal immediately before your PhD defense.
If you have a trusted faculty mentor outside of your advisor, you could try approaching them about the situation, for advice and psychological support, if nothing else.
Some journals allow several authors to share "equal contribution" credit for first authorship. This may be a compromise that is easier to negotiate with your adviser and the new students than outright first authorship.
Finally, as a practical matter, depending on how much first authorship on this particular papers means to you and your future career, it may be best to give in and move on. Treat the incident as a painful lesson in why it is important to explicitly discuss what each collaborator expects to get out of a project in terms of authorship order, both at the very beginning of a project and whenever involving new collaborators.