I'm confused...what should i do? Pls put some sense into me

Pls hear me out. I'm 23 and i've been dating my bf for over 2 years (we broke up for like 4 months in between). Lately our relationship has been a bit rocky, mainly because of the fact that he started ignoring me and I'm in the phase where I'm trying to change my whole career path. I'm struggling to search for my identity and he doesn't really support me. I was a bit depressed and he did things like yelling at me for this and it was really hurtful. Moreover he would spend his free time more with his co workers than he used to and i wasn't really happy because i wanted to see him. Don't get me wrong I'm not a clingy person but then gradually i tried to have some distance from him too and he was completely ok with that. Two months ago, i bumped into my old classmate from high school at an event and he started talking to me online after a week. He knew I have a bf but his conversation was a bit flirtatious. So at first I just answered a few of his questions and i said nothing more. After a couple of days, my bf n i had a really really bad fight and i couldn't sleep at nights plus i was mad at my bf. So i started replying, actively talking back to the classmate. Surprisingly we have same thoughts, opinions, and stuffs. We would talk all night and felt really connected to each other but till that point I never flirted him back. I admit that there r times when i wondered if i was starting to like him. We kept talking like this and one day, he said this was becoming an addition and it got me thinking yes i'm too but i have my bf. We have to stop this. Even though we were really sad to say goodbye, we managed to stop this thing. At the end, i said i was really sad to lose a friend and he admitted to him, i was more than just a friend. Said he knew i have a bf but even in this situation he couldnt help but attracted yet he didnt want to be the bad guy so he'ld stop talking to me. Since then, i feel so lonely and i keep missing him. But i have a bf and i feel really guilty for having somebody else in my mind when i'm beside him. I also wonder if this is just temporary thing which happens when we were having a bad time and somebody came in saying right things and stuffs. Or is it becuz i no longer love my bf? I keep thinking a lot since then. I miss him and how do i forget him? Can i ever feel the same way about my bf before? How do i stop all of this. What should i do?? Pls help me out