I think Cassie always knew the morphing cube was the answer but she knew that her friends and the andalites would never agree to grant morphing ability to the enemy, period. But It would've been too big of a risk if a plan like that had backfired. How would you even hope to implement it? The Animorphs didn't even really trust the rebels, except for Aflan. I think when Cassie saw Tom running away with the cube, she knew that was the only chance to make the others see the possibilities. It was a completely stupid and risky thing to do but ultimately it was her choice that ended the war.
I don't think it was a premeditated act. More like in the heat of the moment Cassie acted based on her instinct, her perception of who she was, who Jake was, her perception of morality and her understanding of the enemy.
There was actually a deleted scene from the end of the book. The book ends with Cassie saying she knew somehow that letting Tom escape was somehow the right thing to do. Immediately after that, in the full version of the scene, she loses that confidence and pretty much goes, "What the hell did I just do?"
The deleted scene also included Cassie concluding that Tobias had chosen to be trapped as a hawk, that it wasn't an accident. The scene was cut because of a gaping plot hole involving Jake returning to the hospital. The text was posted on the morphz forum I think, a long time ago. I'll see if I can dig it up when I have time.
Anyways, I think it was an absolutely brilliant move on KAA's part for Cassie to surrender the morphing cube. For one thing it was a staggering cliffhanger and moved the plot in a great direction. It also echoed the idea of Seerow's Kindness in an interesting way; the war began and ended because of similar acts.