Is ignorance of the law ever a defense?

Yes.  Although it is frequently said that ignorance of the law is no excuse, ignorance of the law is a defense to the crime of unauthorized acquisition of food stamps because food stamps are not physically dangerous.

To cite another example, the accused was Yugoslavian and spoke no English.  He was prosecuted for attempting to export firearms illegally.  He was a seaman who was at port in the United States and was given a form which warned–in English—about the Arms Export Control Act.  Because he could not read the form, his conviction for knowingly and voluntarily violating the law was not upheld on appeal.

As a final example, an individual convicted of knowingly and willfully making a false statement was found to be error because the form filled out by the accused (which was the basis of the prosecution) was inherently ambiguous.