The original law isn't a marriage law, it's a gay marriage law. So you would have to describe your hypothetical as a "gay gun ownership law". But laws other than the one being invoked already allow gay people to own guns.
Furthermore, while you describe the original situation as refusing to do business based on being gay, it's not. It's refusing to do business based on it being about a gay marriage. If a straight person wanted a cake celebrating a gay wedding, they wouldn't be served either, and if a gay person wanted a cake for something else, they would; the refusal is based on the content of the message, not the identity of the customer.
Furthermore, while you describe the original situation as refusing to do business based on being gay, it's not. It's refusing to do business based on it being about a gay marriage.
You make a major mistake when you focus on the situation that the case is about instead of focusing on the law.
If you want feel free to argue, that the court made a mistake when it's treated the bakery as violating the prohibition of discriminating against gay people. Then your problem is not with the law but with the judge for interpreting the situation differently than yo...
Over at Scott Adams' Blog you can find a very fine example of using the 'Rationality Engine' to solve the social problem of assisted dying.