This question can be viewed as a an example of our triparte system of government: the legislature passes the laws, the courts interpret the laws and the executive implements the laws.
In this example (and I don’t really know the law here so I may have details wrong), the California legislature passed a law that said that county executives have the power to issue marrige licenses if all legal requirements are met. Each of the county executives (or the designated staffer in their office) gets to review the qualifications of the people who come in to apply for marriage licenses, intially determine if they meet the requirements, and if they do, issue a license. Typically, this is no big deal, because the staffer will look at the application form, make sure that the parties say they are unmarried, of proper age, etc., and if the forms look acceptable, they issue the license. However, there may be some cases where the executive may have to make judgment calls or further investigate the situation. If someone who thinks he or she should have been granted a license was denied, or someone involved who thinks a license was granted illegally, they can go to the courts to determine whether issuance was proper and what to do about it.
Here, the mayor of San Francisco is considered the county executive because SF is a combined city/county. As such, he has the power to examine license application and to initally determine whether license applicants meet the requirements under law. Here, he made the legal analysis that under the California constitution’s equal protection clause, the requirement that couples be of opposite sex was unconstitutional. Applying that analysis, he decided that he could grant licenses to same sex couples, and did so. Opponents of the practice, as is their right, have sued to challenge the mayor’s executive conduct. The courts will have to first determine whether the equal protection clause means that Prop. 22 and other opposite requirements are unconstitutional, and if so, what to do about the marriage licenses granted (most likely declare them void).
The situation in the Massachusetts <i>Goodrich</i> case came about in a slightly different way. There, Ms. Goodrich and her partner applied for a marriage license and were denied. She then sued to force the local official to grant her a marriage license, and the case worked its way up the ladder of Mass. courts from there.
In short, all of the marriage license granted to same sex couples by San Francisco in the past week (and the marriages performed under them) are in legal limbo until the California courts definatively rule.