The episode you're thinking of is Episode 73 of Sonic X, where Shadow goes after Cosmo.
If you want to relive the moment or check the context, that's the one to queue up. It's a notable turning point for fans following that arc.