Exactly how is Karliah working with Maven now if you don't mind me asking? After you return the skeleton key to the Twilight Sepulcher I remember her saying that she will stay there until the day that she dies. She doesn't return back to the Cistern. If she was Vald.... now that would be a whole different story. And how did Karliah do a maven a favor by exposing Mercer Frey? Mercer wasn't screwing with Maven. He was screwing with the guild by stealing from them, and using guild resource for his own personal reasons. Gallus caught on to his games, and he wand up getting murdered by Mercer to keep him quiet. He then framed Karliah with his death. Karliah wanted payback, and so she used Maven (by attempting to cause trouble with her business), Brynjolf (Selling his soul to that crow bitch) and you (Selling your soul to the crow bitch) to get back at Mercer for not only getting her name cleared, but also return to the crow bitches good side.
Karliah did nothing that benefited Maven. In fact she pissed her off dearly.
Well, if we assume that Maven uses the Guild as a valuable tool, and that Mercer threatened to destroy that tool, and that Maven finances the Guild...then Mercer was both stealing Maven's money and hurting her clandestine right hand. Maven, being a not-stupid business women would understand that any enemy of her enemy is her friend. Because Karliah exposed Mercer's theft and betrayal, and because you then subsequently deal with Mercer, Maven sees that she's now back to her unopposed position of power as a direct result of Karliah and the Player's actions.
Karliah's loyalties were to Gallus and Nocturnal...Gallus a member of the Thieves Guild, and Nocturnal the diety responsible for there even being a Thieves Guild. Moreso than most, her loyalties never waned...not for gold or power...and she spends her exile trying to correct mistakes and restore Nocturnal's favor. The result of this is the Player (Delvin admits you're the best) being made Guild Leader and Maven's power and financial hold on the area restored.
Since the Guild being powerful means even greater odds for Maven's continued success, by extension every single thing Karliah did benefited Maven. And since Maven has to be one smart cookie to have become that powerful, its entirely plausible that she understands that in the grand scheme of things, Karliah's actions made things better for both the Guild and the Black-Briars.
At least, that's how I figured it.