The source of the story is the Þrymskviða poem (The Lay of Thrym), which is included in the Poetic Edda.
It was Thrymr, king of the jötnar, who stole Mjölnir. He then demanded the gods allow him to marry Freyja, in order to return it. Thor travelled to Jötunheimr to claim back his hammer, and he managed to sneak in dressed as a bride.
Loki wasn't involved in stealing the hammer, but he did accompany Thor, disguised as his bridesmaid.