YES.
It is pretty much the norm in Eurasia and Russia. On the ground, pull up the window shades, open the window, vents open, lock cockpit door and smoke away. In flight, its even easier. And if a flight attendant smokes, she'll come to the cockpit too.
What about the issue of withdrawal symptoms if a pilot can't smoke and is heavily stressed on a long flight, would this become a safety issue? Who knows.