I found some pages on the web on how to run an AppleScript from the terminal, but this seems to be the only one that works in my situation:
echo 'tell application "Google Chrome" to quit' | /usr/bin/osascript
In my case, my keyboard stopped working so I wanted to safely shut down the programs via ssh before I rebooted the workstation.
Try:
/usr/bin/osascript -e ‘tell application “Thunderbird” to quit’
You can also feed it a file by omitting the -e flag and replacing it with the path to a script file.