I think that the ultimate way to deal with a situation like that is to disarm without being insulting... the ultimate outcome is when both the target and her friends like you when you walk away.
I don't know if I would have dealt with the situation any better spontaneously, but now when I think about it a reply like "hey honey, don't be jealous, you can have your friend back soon" (said with a cocky/funny smile) would have been better... After saying that I would have said "nice meeting you and your impatient friend *wink to the friend*" and just walked off. If she would have made some kind of reply ("I'm not jealous, he's just not hot!") I would have perhaps have waved and smiled over my shoulder on my way out.
The MOST important thing in that kind of situation is not letting her put you down.. that part you passed. The second most important thing however is appearing as a fun, easy-going guy. In that area I think that perhaps you could have done better (depends a bit on your delivery, and if her friend was insulted or not). BUT it WAS a tough situation, and I think you deserve credit for not getting entirely blown out of frame. That could have easily happened to many of us (including me!), I think.
Remember: Her friend can't possibly KNOW if you are attractive or not unless she's seen you in action... Attraction is about personality and actions, not looks. That means that either she's lying (she's seen you in action and DO think you're hot.. she is afraid that you'll steal her friend et c) OR she doesn't know what the fuck she's talking about. So her "not cute" statement almost certainly means something different entirely. Just pick one interpretation and throw it in her face in a calm matter-of-fact way, like I did in my example
