Keatings netted two before the break and rounded off his trick just before the hour mark with a late strike from Gary Oliver sealing an emphatic victory for the Jambos.
Hearts opened the scoring on 13 minutes when Keatings fired home the rebound after Sam Nicholson’s backheeled attempt from Billy King’s cutback was scrambled clear by Jason Thomson.
Keatings doubled the visitors advantage a quarter of an hour later when he finished low past Kevin Cuthbert after first King and then Prince Buaben had seen powerful shots of their own blocked.
The hosts almost got one back just before the break but Martin Scott’s header from Ryan Conroy’s corner flew just wide.
Keatings almost scored his third just after the restart but his low shot from the edge of the box was blocked by Cuthbert after a thrusting run down the left from Jason Holt to set him up.
However the former Hamilton forward was not to be denied and he secured the match ball when he curled a delightful left-footed free-kick past Cuthbert from 20 yards.
Oliver rounded off Raith’s misery when he powered home a low strike from just inside the box in injury time.
The win moves Hearts clear at the top of the Championship and gives them a two point cushion over second-placed Queen of the South.