Florian Dick gave the visitors the lead in the 15th minute before Sam equalised in the 38th minute. Patrick Helmes gave Leverkusen the lead after 68 minutes and Sam finished off the scoring in the 84th minute.
Leverkusen nearly grabbed the lead in the second minute but Kaiserslautern goalkeeper Tobias Sippel superbly stopped Stefan Reinartz's attempt on goal.
The hosts went close again six minutes later, only to see Eren Derdiyok redirect Renato Augusto's pass wide of the goal.
Kaiserslautern capitalised on their first chance as Alexander Bugera's free-kick bounced off the Leverkusen wall back to Dick, who hammered a low blast from 30 yards just inside the left post to give them the lead.
The visitors should have doubled the lead after 32 minutes with Jan Moravek's through-ball finding Adam Nemec, who ran past Leverkusen goalkeeper Rene Adler but could only find the side-netting.
Leverkusen defender Manuel Friedrich had space for a header three minutes later but nodded wide of the goal from six yards out.
The hosts grabbed the equaliser in the 38th minute with a low shot from Sam, who charged onto a Reinartz pass and finished well.
Leverkusen's Tranquillo Barnetta was close to giving the hosts the lead after 58 minutes but Sippel fended the Swiss international's looping shot over the crossbar.
Leverkusen finally jumped ahead in the 68th minute with Renato Augusto running onto a through-ball from Simon Rolfes before crossing to Helmes, who struck home easily from three yards.
Adler made a superb save from Erwin Hoffer in the 80th minute before Pierre de Wit found the top of the netting a minute later.
Sam's second goal which decided the game in the 84th minute was a fantastic effort, as he volleyed high into the top corner from nearly 40 yards.
It gave Leverkusen only their second home victory this season and moved them to within three points of second-placed Mainz, while a sixth loss in the last seven matches means Kaiserslatuern remain in 15th place on 10 points.