The new husband would become the legal father of any children. The modern word for such a relationship is a "stepfather."
Under this interpretation, Heli as Joseph's father, Jacob his stepfather (or vice versa). Of course, the problem here is that for Heli and Jacob to be siblings, they would need to have the same father (which they don't, by the geneology).
So the only way that the "levirate marriage" theory works is for this rather improbable situation to have happened for thirty-odd generations running, until Solomon died and Nathan married one of his widows....
Matthew uses "begat", so his list would have to be the biological fathers. Luke uses "the son of", so his list would have to be the stepfathers. Even if we bend over backwards and admit the possibility that a.) Joseph was the product of an uninterrupted thousand-year string of such occurences; and that b.) Luke, in compiling his genealogy identified every single man as the "son of" his mother's second husband, there are still a couple of problems for blutarsky's assertion that the two lists are consistent.
To demonstrate these we need to do the "scholarly work" of a.) counting; and b.) reading the rest of the Bible.
By counting, we can see that Matthew says there were 25 generations from David to Joseph, while Luke says there were 40. Further, we see that while the two lists both trace the same line from Abraham to David, in between David and Joseph they have only two names in common: Shealtiel and his son Zerubabbel. The problem here is that by Matthew's count, there are 10 generations between Zerubabbel and Joseph, while Luke puts 19 generations between them. One could argue that the author of Matthew is leaving out generations in the sake of brevity, but then he goes on that weird numerology kick about 14 generations from this to that, and another 14 from that to the other.
By reading the rest of the Bible, we can see that Matthew's list follows the genealogy given in 1 Chronicles Chapter 3, except that the gospel author skips over four kings of Judah (Ahaziah, Athalian, Jehoash, and Amaziah should be in between Jeroham and Uzziah). We also see more trouble from Shealtiel and Zerubabbel. Chronicles says Z is S's nephew, while Matthew says S "begat" Z. Luke can possibly get around this, by the argument that "son of" need not mean "direct biological son of", but then Luke's getting from Nathan to Shealtiel through a list of names that don't seem to correspond with any Old Testament source.
We also see that none of the names on either list after Zerubabbel and before Joseph seem to appear anywhere else in the Bible. Chronicles doesn't list either Rhesea (per Luke) or Abiud (per Matthew) as one of Z's many children. It lists two sons: Meshullam and Hananiah, and proceeds to trace the descent through Hananiah.