George Weasley somehow got news of what happened at Hogwarts (through Ginny, maybe?), put two and two together and showed up at the school in the evening of the 17th. It turns out that TrueHeart stole the genderswap formula from Weasleys' Wizard Wheezes, unaware of the fact that they hadn't released it yet because George hasn't figured out how to make the effect wear off after a while. Thankfully, he did produce an antidote.
After dinner, the affected students were instructed to queue up at the hospital wing in order to be given the antidote. Originally, McGonagall's idea was to give it to them right at the dinner table, but since certain students had such an enthusiastic reaction to switching genders (yes, Jamie and Romilda, she's staring at the two of you!) she eventually decided it would be best to administer it in a place where they could be sure they all took it. They were promised that, once they woke up in the morning, everything would be back to normal.
(Alison, a crazy idea: given Evan's "delicate condition", maybe he could stay that way for a while longer? Either Madam Pomfrey will find it best for him to postpone taking the antidote for now, or, given that I don't see him telling anyone what's going on, we can make the antidote have no effect on him. What do you think?)