There is a good summary of the debunkings of this thing here:http://www.snopes.com/holidays/christmas/music/12days.asp
One of the points that it makes, was that in one of the earliest printed(English) versions, it is presented as a memory and forfeit song, which would account for there being so many versions, with so many different gifts--
Also mentioned is an old song, "A New Dial" or "In Those Twelve Days" which actually lists the Beatitudes, etc.