She doesn't have enough boundaries at yours and is being taught the wrong life values by her mum. Sadly the life values is a really hard thing to change, but the boundaries at yours is an easier one.
You sit her down you tell her what is absolutely not acceptable in your home. No hurting others, saying nasty things, ringing the doorbell constantly, bullying step son st school etc. give her clear consequences for those actions, a discussion about why she did it, removal of her things or privileges and be consistent.
Then reward her good behaviour, I created a family value reward chart, every week they wrote down or said what value they did during the week then got to take a post it note from their reward box. Half of them were blank showing them that good deeds are not done for reward, one was high value (£20) the rest had small value things like sweets, a book, magazine, choose tea etc. it took a while but it worked, they spoke a language of values at ours, it became something they thought about.
But boundaries are so important if she doesn't have consequences for her actions she's never going to learn.
As for crazy ex, she needs a firm boundaries too. I found the power of no, works wonders. We had a mantra of accepting the reasonable rejecting the unreasonable. Her threats were hollow, she needs us to babysit you see so she can have a social life. Also we only gave her one avenue for communication, text message and if they were too often, abusive, not related about the kids then that was cut off and she had to communicate via email.
People behave towards you how you let them. It's time to say no, it's time to put some boundaries in. And at first they will be pushed back on but be consistent, be firm, be fair.
Bring a step parent is such a tough gig I absolutely feel for you- but it can be solved, just keep your standards high and don't accept abuse it should never be part of the deal.