Not sure if it would be a good idea. You should discuss this with your friend first. I once dated my ex's best friend, but she was ok with it. She was actually relieved because her friend had unrequited feelings for her and I was distracting her from that (mistake on my part tbh) but still. It's just going to depend on how much drama this will cause.
A long time ago I dated the ex of one of my best friends and what I regretted the most was keeping it a secret from them. It ate at my conscience for a while and made the beginning of my hidden relationship really rocky and awkward. My friend eventually found out, months after we had been seeing each other but to my surprise they were OK with it. Really just mad that I hid it from them but we talked it out. It actually turned in my longest and most intimate relationship to date. If you feel really strongly for that person and you're worried your friend will disapprove, it's probably best to be truthful with your friend or else you run the risk of ruining a good friendship along with making things extremely awkward with your crush if you do decide to pursue a relationship. That's a lose/lose for everyone involved. Relationships built on lies are doomed to fail, even if those lies aren't between each other.
For me...I would not do this...but again..this is just my opinion...I remember someone that was close with a cousin of mine who was gay and he had this boyfriend at the time we started hanging out. Not too long after...their relationship ended and the thing was that I had become really good friends with the ex and therefore...I still hung out with him as well. Although nothing sexual had transpired between us but my cousin's friend became really angry at me and had assumed that me and his ex were sleeping around and started these rumors about us throughout the gay community. Even when I confronted him about it...he was still adamant about what he assumed about us. To make a long story short...it wasn't until a couple of years later and my cousin's friend was in a new relationship with someone that I knew pretty well that situation between us took a turn for the best. This guy finally came to realize that after all of this time...I was telling the truth. Unfortunately, for me...it was kind of too little ...too late. I accepted his apology..but the friendship that was established between us had never went back to the way it started out. Once he finally listen to what I was trying to tell him a couple of years ago...I was pretty disappointed that after many times of me trying to tell him truth that he never gave me the benefit of the doubt that I was actually telling him the truth and it took a new boyfriend to explain what kind of guy I was and that he do believe me. He had kept saying that I was his friend first and he could not accept that I was messing around with his ex although it was not true. He also admitted that his ex at that time had a crush on me which I did not find out until a couple of years later but I was interested in someone else and besides...I do not date guys that have been involved with friends of mine...I just don't.
Many people will say there's nothing wrong with dating a friend's ex, and that it's none of their business...which, to be fair, is technically true, of course. But that said, this is something I would typically advise people not to do. Granted there are a few situations where it might work out, but on the whole, this inserts you into a very personal part of your friend's history, and one that they might very well still be feeling hurt over, even if they appear to be doing fine. The fact that you're not doing anything "wrong" might not stop your friend from feeling betrayed, and causing a rift in your friendship that could take a very long time to heal (if it ever does).