The Resident
(2011)

Max (Jeffrey Dean Morgan) becomes completely obsessed with Dr. Juliet Dermer (Hilary Swank), and starts secretly drugging her at night so he can come in her room undisturbed to have his way with her. When his abusive grandfather August (who's always comparing his grandson to his dad who shot his wife and killed himself) interferes, Max stabs August (Christopher Lee) in his bed with a syringe to his neck. When Juilet's ex Jack (Lee Pace) shows up one day to find one of Max's hiding places to peep, he gets killed too.

Eventually, Juliet discovers (thanks to her secretly installed CCTV) that Max has been frequenting her apartment while she slept. This leads to a flight and fight pursuit through the interior of the apartment complex. This ends when she discovers Jack strung up and left to vermin in a locker, then manages to get her hands on his nail gun, leaving him for dead, stuck in the floorboards with several nails stuck in various parts of his body.

Thanks ND Woods!