I too have a nine-year-old girl, so I totally understand how girls this age long for a best friend and cling to that relationship and want to be "nice" to everyone, all the time. And I know how the niceness can make them fail to stand up to girls who are bullying and pushy, which her friend is. And oh, how the girls hate it when parents criticize their friends. But this girl is on the road to real trouble, and I think the grade change is the tipping point. I would take that very seriously as the final indicator this is not a friend for your child to have.
You know about the change, and it's fantastic that your daughter told you about what happened, including telling you something about her friend that was negative. So obviously the grade change is something your daughter knew was wrong, and obviously you two have good communications between you because she told you (and that is great!). You don't want to quash her desire to commuicate with you by making her think you're mad at HER, or by seeming to "hate" her best buddy. But you also have to address this.
I agree with the person who posted who said this is a chance for your daughter to learn for herself that not everyone is a true friend or a person she should hang out with. Open-ended questions are good, but I would go further and talk with your daughter -- an opening is the changed grade. "Do you think that was right of her to do that? What would you do if it were a grade on a test that she changed, and not a behavior grade? Did you tell the teacher? Why or why not?" You'll have to ask in the most non-judgmental voice possible so she thinks for herself rather than getting upset that you're "mad" at her.
You also can talk with her generally about what makes a good friend and what makes a not-so-good one, and I'd recommend getting some of the American Girl books about friendship. Not the fictional books but the AG "Girl's Guide to Friendship" and guides like that. They are excellent and give you an opening to guid her to think about her own friendships.
If you eject the friend from her life with a big ultimatum and tears on her part, the friend will become "forbidden fruit" to your child and they'll be even tighter when at school. I liked the idea another person had of getting your daugher into activites (classes, scouts, etc.) with other kids, and I'd add that you're still the one who can schedule play dates, so set up plenty with other kids - you might be surprised to find that your daughter is delighted when you say, "So-and-so is coming home with us today for a play date!" even if the girl isn't the best friend. And don't say that you're doing this because you want her to see someone besides the friend.
And you still control her access to this girl outside school -- find "reasons" why there can't be a play date with her (maybe because your child will be going off to scouts or dance class or whatever); unsubscribe to the Club Penguin account for a while (tell her it ran out and you'll resubscribe later, for her birthday, or at some date a few months away,but again, make clear it's not a punishment for her, and maybe sign her up for something else that doesn't involve codes and prizes); ensure that only you, and not your daughter, picks up all phone messages and call the girl's mom immediately to report any more nasty messages; schedule something else distracting for your daughter at the same time as the friend's birthday party, maybe.
Oh, and if I were the friend's mom I would want to know about the grade changing so I could nip that in the bud immediately.