Saw VII

Two men, Brad and Ryan, awaken in a metropolitan storefront window, bound at the wrists to opposite sides of a worktable with a circular saw in front of each of them. Their mutual lover, Dina, is suspended above a third saw. As the scene draws attention and police arrive, a puppet informs the men that they can kill each other or let Dina die. They initially fight each other, during which Brad is cut, but ultimately choose to allow Dina to die instead.
Matt Gibson, an internal affairs detective at Mark Hoffman's precinct, is met by Jill Tuck, who incriminates Hoffman in exchange for protection and immunity from prosecution. Gibson, who has distrusted Hoffman ever since Hoffman saved his life by gunning down a homeless man, agrees to her terms. Meanwhile, Hoffman abducts a skinhead gang - Dan, Evan, Jake and Kara - and places them in a trap that kills them all, leaving the reverse bear trap at the scene to incriminate Jill, who is put into protective custody. After a meeting of Jigsaw survivors, including Lawrence Gordon, who cauterized his leg on a steam pipe after escaping the bathroom and now uses a leg brace and cane, Hoffman abducts Bobby Dagen, a self-help guru who achieved fame and fortune by falsifying his own survival story. He sends Gibson videos with cryptic clues to the game's location, offering to end the games if Jill is given to him.
Dagen awakens in a cage in an asylum and is told that his wife Joyce will die if he doesn't save her within one hour. Joyce is chained at the neck to a steel platform that gradually pulls her down as she watches Dagen's progress. After he escapes the cage, which dangles over a floor of spikes, he begins searching for Joyce. Along the way, he finds Nina, his publicist; Suzanne, his lawyer; and Cale McNamara, his best friend and co-conspirator. All three are in separate traps representing the three wise monkeys and are killed despite his efforts to save them. After he removes his upper wisdom teeth to obtain the combination for a security door, Dagen finds Joyce and is forced to reenact the trap he claimed to survive: he must drive hooks through his pectoral muscles and hoist himself up to the ceiling to deactivate her trap. He fails, and is forced to watch as a brazen bull capsule closes around Joyce and incinerates her.
Gibson eventually discovers the game's location and sends a SWAT team, who are sealed in another room and killed by toxic gas. Simultaneously, he and two officers infiltrate Hoffman's command center in the junkyard, where they find Dan's corpse sat in front of several monitors connected to the police headquarters security cameras. He sees Hoffman brought into the morgue in a body bag and tries to warn Palmer, but is killed by an automatic turret gun along with his men. Hoffman kills Dr. Heffner, Palmer, and everyone else in his path to Jill, who briefly escapes before she is caught and knocked unconscious. He straps her to a chair and locks a reverse bear trap to her head; she awakens as the timer starts and is killed when the trap activates, tearing apart her face.
After destroying his workshop, Hoffman is attacked and subdued by three pig-masked figures, one of whom is Gordon. Flashbacks show that John Kramer found him unconscious by the steam pipe and nursed him back to health, and Gordon has assisted him ever since. This was known only by Jill, who delivered a package to him at the hospital, a videotape in which Kramer asked him to watch over Jill and take action if anything happened to her. To this end, Gordon has Hoffman brought to the disused bathroom and shackled by the ankle to a pipe. Throwing away the hacksaw he had used to sever his own foot, Gordon turns off the lights and seals the door, leaving Hoffman to die.

Question: Who kills Dr Heffner ?
Answer: Hoffman kills Dr Heffner.