In linguistic terms, this is what’s going on:
If you think about it, where you put your tongue to make the sounds “d” and “t” are exactly the same place. The two sounds are just analogues of each other (called allophones). While “d” is “voiced”, “t” is “devoiced”. If you make each sound while your fingers are on your the front of your throat, you’ll notice that you can feel a vibration with the “d” but not with the “t”. That’s what “voiced” versus “devoiced” means. The “d” is voiced.
This is part of the study of phonology. If you search the term in wikipedia, you’ll find a lot of other cool info. Well I think it’s cool anyway :).
What’s happening here is the phrase “used to” basically functions as one word when it takes the semantical meaning of “an auxiliary verb expressing an on-going action done previously” is that since the “s” sound, is devoiced, after making it, the tongue moves up to the alveolar ridge, where the “d” and “t” sounds are made, and continues the devoicing since the two sounds surrounding the “d” (the “s” in “used” and the “t” in “to” are devoiced.
In the sentence you gave about Maggy, the phrase does not take this meaning. The two words “used” and “to” retain their separate meanings, and thus, the tongue does not move directly from one to the other without pause, but instead a native speaker would generally pronounce “used” and “to” distinctly, to invoke the separate meanings of each word.
(I tried to write this in the most lay-person terms possible, but I’m not sure I achieved that, so if you don’t understand something, it’s my fault, not yours, please ask!)