Kiss Kiss Bang Bang
(2005)

Harry Lockhart (Robert Downey Jr.), a thief posing as an actor and then a PI, gets involved in a series of mysteries:

#1 – the heiress: Mogul Harlan Dexter had his rebellious and estranged daughter put into a mental institution and hired an actress to pose as her long enough to stage a return from Europe (where she had been living) and a public reconciliation to settle the question of the family fortune. However, when her boyfriend was set to return to town (and would recognize the fake), he had her killed. When Harry and real PI Gay Perry (Val Kilmer) go to a stakeout Perry has been hired to do, they see the body being dumped. When it is realized that Harry and Gay saw the dumping, Dexter has the body moved to Harry’s room and attempts to frame him, but he figures it out in time.

#2 – the sister: Harmony's sister, (believing the lie Harmony had told her as a child - that her father {who was molesting her}, was not her real father and that her real father was the actor in the PI series) sees Dexter, the man she believes is her father, having sex with the actress she believes is his daughter. It is too much for her and she commits suicide. The stakeout was set up by the sister so that they would film the “incest” and Dexter would go to jail. Because it was at Dexter’s hideout, they saw the body being dumped instead.

Harry shoots and kills Dexter in the ending gunfight as Dexter desperately tries to kill off everyone who knows about the switch and cremate his daughter’s body. Perry, Harmony (Michelle Monaghan) and Harry return to the town where Harmony and sister grew up for her funeral. Perry visits Harmony's bed-ridden father and beats him. Harmony and Harry, childhood sweethearts, stay together. and Harry goes to work for Gay.

Thanks Mary C!