Sam's supernatural abilities are the result of him being fed Azazel's demon blood while he was an infant. Sam exhibits signs of precognition throughout the first season, manifesting as dreams of others' deaths and later as visions.
Sam has deep-seated trauma, clearly, that materializes the second he feels any kind of positive feelings about Emma; whatever happened to him at The Woods has led him to hallucinate violent, intrusive things.