In my context of dealing with situations as similar as this i say to you with no offense that you are showing the characteristics of an average frustrated chump.
this is how i was taught and this is how i am gonna teach you.
1.what the fuck are you doing. why are you being her emotional tampon. hugging and talking while she's crying is what a friend would do, and thats the last place any man wants to be. Don't be surprised if she says to you "Lets just be friends". its happened to me and many others, don't let it happen to you.
For this first problem i say. never get yourself too close to a woman who is experiencing negative emotions, even if you are dating her. Be with her when she is in a positive mood and get the fuck out of sight and disappear for a bit when she's in a negative mood.This because if your with her only when she's in a positive mood then thats the mood she's going to associate you with whenever she sees you(this is good) but if your with her when she's sad, angry, emotional or to sum it up in a negative mood then of course she's gonna re-link with those emotions when she sees you (this is bad). do you understand chump?

.
2. Don't think because your friend is ugly he wont be able to get her, you said yourself he makes her laugh. Hes making her feel positive emotions and that puts him at an advantage over you.
ill come back to this in a moment but id like to speak about one final thing before i tell you what to do.
3. Your being desperate and your last comment displays that, you want her that badly, even if you act cool around her your body language towards her will show otherwise, this will repel her away from you. I say relax, there is a shit load of women out there and every man who's been with his fare share of women knows this. take it easy boy flirt with other girls, get their numbers and Fuck them if you have to. And this is where id like to get back to your friend.
You dont have to do anything i tell you but im writing this to show you what a true friend and good PUA will do. (bros before hoes) unless your marrying this girl, shes not important and I as an individual will try to hook your friend up with the girl, if she sees the combination of you showing no interest in her, fucking other girls and living the life. She will be a lot more attracted to you. She will pursue you. And im speaking from personal experience.
But hey thats not what you want to do. so your best bet would be to stop acting like a friend, and start acting like man.
Help your friend out by getting one of her friends to go out with him if you want. short of that go have a battle royale over her, but i know at the end of the day i will never fight with a friend just to get what's in between a girls legs.
Lastly, Relax there are 3 billion women in the world, if you dont get this one its not the end of the world go to the next one.
Good luck chump. Get back to me if your successful.