Alright. Here is my theory.
The killer is Phoenix Wright. The accomplice is Miles Edgeworth. Both of them, plus Larry and Franziska were in on the corrupt prosecutor case. Larry wanted to fake his death and start over, which is what he messaged Franziska about. The night goes on as shown until the first body discovery. That body is from the corrupt prosecutor case, disguised to look like Larry. The group then locks Franziska in the study but with Edgeworth’s help, she gets out through the right side and retreats to the bathroom there. When Payne goes to the file room, Phoenix knocks him out and goes to get the key to the study from Alfred. This is because Alfred is actually Phoenix’s butler. As such, he never saw anything suspicious. Or at least, nothing that a loyal butler would consider suspicious from his master. Phoenix then grabs Payne’s unconscious body, moves it into the study, locks the doors to the cellar from both ends, and does the key swap thing with Edgeworth where he slides the key under the door. There, Edgeworth moves back to the library, locking both doors to the dining room in the process. Larry knocks him out and retreats to the left side bathroom. Then, Phoenix approaches both bathrooms, luring both of them out of there with information about the corrupt prosecutor case. Or maybe telling them that the other one was dead. This is my theory.