Scott puts Krissy on the stand and the stress is too much for her and she either collapses or Diane acts for a recess. I mean, Korte isn't going to miss an opportunity to make Sonny/Carly look better than Ava/Scotty. Pregnant or not, Krissy did witness her father at his worst and that goes to his character. Scotty could even press Laura to reveal that Cyrus told her that it was Sonny who beat him unconscious in a church. Even with all that Ava has done. I don't recall that she has ever been arrested vs Sonny who has been arrested countless times and is a KNOWN crime boss in PC.
What judge would award Sonny over Ava? On paper--she is the better parent. As Michael said, Avery loves her mother and it will hurt her if Sonny blocks contact with Ava. She's old enough to ask "Where's mommy? I wanna see mommy."