When the giant seed finally reaches the final stage of its metamorphosis and starts sucking the life out of everyone except for Cosmo, she takes the Chaos Emeralds to Eggman, thinking that he'll know what to do. Unfortunately, Dark Oak attacks Cosmo, who drops the Chaos Emeralds into space. Thankfully, they close in on Sonic and Shadow, who use them to transform into Super Sonic and Super Shadow and attack the Metarex seed. But, once they destroy it, they reveal an even smaller planet with a gravitational force that could potentially destroy the whole galaxy!
Cosmo feels helpless but her mother, in her mind, assures her that she is the one who will save the galaxy. She then transforms into a new form and becomes determined to stop this once and for all. She flies over to the planet, passes through the gravitational force that neither Super Sonic nor Super Shadow could pass through, and plants herself atop it. She then becomes a tree, saying that she has now immobilized Dark Oak. She tells Tails to load and fire the Sonic Driver and shoot it at the planet. Everyone is shocked and does not know whether or not to risk saving the galaxy if they're going to kill Cosmo in the process. Tails, however, is very hesitant, but Cosmo re-assures him that her seeds will be spread throughout the galaxy. He then thinks back to all of the good times they've had and, tearfully, fires Super Sonic and Super Shadow at the planet, completely destroying it. Cosmo then greets Tails a final "farewell" vision saying she'll never forget Tails.
(Thanks to whom ever came up with this info on Wikipedia)