The site aims for a ratio of at least one vote on questions for every three votes on answers.
The limit used to be 30 votes a day. To encourage votes on questions, the limit was raised to 40 votes a day, but only if you observe the one to three ratio (or better) on questions. That is, of your forty votes, at least ten must be on questions, with the difference for answers.
When the system capped you at 39, you had voted on 30 answers and 9 questions, and your 40th vote was on a answer. If you had changed that vote to one on a question, the system would have accepted your 40th vote.