How do you refer to someone whose title has changed?
The person is now a professor, so refer to them primarily as that.  If you are concerned about confusion, you can add the additional information in the sub-clause, where it reads more smoothly:


  I took course Y from Prof. X, while he was a [lecturer, postdoc, whatever] at [instutition]"