See post #104 for a partial explaination of totalization. I believe all a person need to earn is 6 quarters before he can combine his work credits from Mexico and USA to get SS benefits.
When an illegal alien works under a fraudulent SSN, they keep the W2s. When they become legal and get a valid SSN, they come into the Social Security office with a slew of W2's and SSA has to add all those W2s to their earnings record. Here is some of the SSA policies for correcting earnings records. It does not explain everything.
http://policy.ssa.gov/poms.nsf/lnx/0103870001!opendocument
It was very common for the alien to get temporary legal status and apply for and get the benefits before the legal status expired. Once they got legal status the benefits could not stop. The law has changed recently. Now it says something like, if you loose your legal status and are caught illegaly working, your benefits will stop. I can't remember exactly what the new law says and am too tired to look it up tonight.
Ok, I looked it anyways because I can't sleep.
On March 2, 2004, President Bush signed into law H.R. 743, the Social Security Protection Act of 2004 (Public Law 108-203).
The following descriptions of provisions in the bill are identical to the descriptions in Legislative Bulletin 108-17.
(snip)
Prohibit Benefits to Persons Not Authorized to Work in the
United States
Would provide that the payment of Title II benefits based on the earnings of any noncitizen would be precluded unless (1) the noncitizen had ever been issued an SSN indicating authorization to work in the United States, or (2) the noncitizen, at the time any quarters of coverage are earned, was admitted to the United States under a B1 visa (for business purposes) or D visa (crew member--e.g., for an airline).
Would be effective with respect to Social Security numbers issued on or after January 1, 2004.
http://www.ssa.gov/legislation/legis_bulletin_030404.html
That's really an empty threat when you consider the amount of interior enforcement and investigation of illegals in the workplace that the government does.