Unlike some I symptahise with you, when you're in severe depths of lonliness sometimes you're blinded by it, and you grab hold of any attention. Unfortunately you found it in slightly the wrong place, but it doesnt mean you have to punish yourself. You had a need that you fulfilled, it just so happens it was fulfilled with consequences but I wouldn't feel ridiculously bad. It seems to me he instigated the cheating. If anything, instead of beating yourself up and feeling guilty, you need to feel sorry for your friend! She's with a boy that obviously is not devoted to her, and there's nothing to say he won't do it again. You need to tell her what you did and hope she will understand if she is a true friend. You'll punish yourself more if you let her continue in her relationship and further on down the line this boy does the same and she's badly hurt. You'll end up disliking the fact you didn't warn her sooner. Yes she'll more than likely be angry, but with time friends understand.
I can see why you still feel attached to this boy when he's online, its almost like he was your 'saviour' when you felt really low and alone. Now he's left you, it's obviously a big shock, he inveigled you into thinking there was a light at the end of the tunnell - you would be with him - and then he deceived you, you should be seriously disliking this boy, not pining for him. He doesn't seem like a genuinely nice person, and is seeing how far he can push you and your friends limits before you feel the moral right to tell her what you did. Don't let this boy get what he wants by wanting him. You need to tell her what happened, let him get what's coming, taste your own medicine and move on. Good luck with everything xxx