Callie (Sara Ramirez) and Arizona (Jessica Capshaw)'s custody hearing on Thursday's episode of Grey's Anatomy was just as ugly as we anticipated.

Throughout the episode, several of Calzona's Grey Sloan colleagues are trotted up to the witness stand during the court proceedings, and each faces their own personal trial. (Sofia, blissfully unaware of the whole custody battle, spends the days with Maggie.) Penny (Samantha Sloyan) swears under oath that she loves Sofia, and rattles off the 6-year-old's her favorite toy, cereal, etc. to back up her claim. But then Arizona's lawyer goes in for the kill and gets Penny to admit that she doesn't even know what grade Sofia's in, let alone the outfit she was wearing that morning. Ouch.

When Meredith (Ellen Pompeo) takes the stand on behalf of Callie, she gets lambasted basically for taking Callie's side because they're both single parents. Bailey (Chandra Wilson) gets coerced into saying that Arizona's schedule is more grueling and unpredictable since she's dealing with pregnant mothers. Webber (James Pickens Jr.) testifies on behalf of Arizona, but Callie's lawyer uses his and Arizona's trivia nights to allege that Arizona regularly neglects her childcare duties to go out drinking.

Finale Preview: Get scoop on Grey's Anatomy and other season-enders

Things aren't any easier for Callie and Arizona themselves. Callie is forced to recount her car accident the day Sofia was born. Her lawyer then attacks Arizona for not being part of Callie's pregnancy until after the fact, and notes that Sofia's last name is Sloan-Torres, not Robbins. Unfortunately, right as this is going on, Arizona gets a 9-1-1 call from April and is forced to leave the courtroom and go back to the hospital to perform emergency surgery on her pregnant patient from last week.

Ahead of the ruling, Callie tells Arizona that she'll always think of Arizona as a good mom. Arizona apologizes too tells Callie that she never would have let her lawyer attack Callie like Callie's lawyer attacked her. (In fairness, the judge did warn them both that they would probably end up hating each other when all was said and done.)

Finally, the judge grants sole custody to ... Arizona. Twist! She goes to collect Sofia from Meredith's house, and Callie can do nothing but sob as she watches her daughter walk out the door. She's now faced with the decision of whether to actually go to New York with Penny and give up seeing Sofia basically entirely.

Other items of note in the episode:

Stephanie (Jerrika Hinton) regrets breaking up with Kyle (Wilmer Valderrama) and almost drunk-dials him, but Jo (Camilla Luddington) intervenes. But at the end of the episode, Kyle is back in the hospital with what appears to be meningitis, and wants nothing to do with Stephanie.

Over drinks, April (Sarah Drew) and Jackson (Jesse Williams) hammer out their own informal future custody agreement. Jackson tells April he'd like to be there for the birth and to help out with subsequent feeding schedules. Then they start getting really ahead of themselves and dividing up holidays. April wants Easter and agrees to give Jackson the Super Bowl(?!) and Halloween. Christmases will be split. Yeah ... this will go smoothly, I'm sure. By the looks of things, the judge's ruling won't be the final word in Arizona and Callie's custody battle either.

What did you think, Grey's fans? Are you surprised Arizona was awarded custody of Sofia? Do you think Callie will still go to New York with Penny? And who will be the participants in the shocking hook-up teased in the promo for next week's episode?

Grey's Anatomy airs Thursdays at 8/7c on ABC.