Yes, my best LOR was from my o-chem professor, and I had a B for first semester, and a B+ for the second semester. I am closest with him, we get along great, and he definitely knows me better than all my other professors. I asked him to write me a letter, he showed it to me, and it was stellar. I wouldn't discount a professor just because you didn't have an A in their class.