Optimize update_thread_counters() / update_thread_data()

- merge both functions into one, but retain backward compatibility
- save two DB queries
- reliable replies counter supplied by existing DB query