A simple way would be to use two queries. Perhaps this will do the trick
SELECT AVG(total_votes) AS avg_num_votes, AVG(average_value) AS avg_rating FROM MyThings WHERE total_votes > 0
This should give you the avg_num_votes for all items (that have at least one vote), and avg_rating across all items (again for those with at least one vote).
With these values in hand, construct query #2 and use ORDER BY:
SELECT thing_id thing_name FROM MyThings ORDER BY (($avg_num_votes * $avg_rating) + (total_votes * average_value)) / ($avg_num_votes + total_votes)
Before submitting this query, replace
$avg_rating with the results from query #1.
Warning: Haven't tested this, and I'm not familiar with Bayesian ranking.
Hope that helps!