Fingersmith
(2005)

Pickpocket Sue agrees to become heiress Maud's maid in order to help in a scheme to get the isolated woman to marry Gentleman (thus securing them her fortune) before having her institutionalized.  Sue falls in love with Maud, but goes through with the plan.  However, when the time comes, it is Sue who is put in the institution - turns out Maud struck a deal to fake her disappearance so Maud could escape her controlling uncle and gain control of her fortune.

Maud regrets her betrayal of Sue (who she also developed feelings for) and returns to Sue's childhood home where she learns that she and Sue were switched at birth (it is actually Sue who is the daughter of a heiress) and Sue's mother left her fortune to the two of them.  Sue breaks out and returns home where she, Maud, and Mrs Sucksby confront Gentleman.  He is killed in the ensuing scuffle but Mrs Sucksby takes the blame and is hung.

Sue and Maud reconcile, both confessing their earlier duplicity, and start again as independent women of means.

Thanks Mary C!