I'm not sure on what basis you (or she) could take this to Court. It would probably be possible for you to apply for an order for sale of the whole flat (which is not what you want), and it might be that you would be able to do this just for the part of the ownership which your friend owns. But if it was possible to get such an order the Court might order that it was sold on the open market, rather than simply being offered to you.
I think you need to see a solicitor who is experienced in these issues.