I think you completely started a new cycle in your tank by removing the sand. Yes your tank being overstocked can cause ammonia but the fact that you had 0 nitrates showed that no beneficial bacteria was within your tank. Seems like everything you're doing is correct though by adding in BB. With that stock in a tank that size i believe you should be getting well over 20 nitrates. Great to hear that you didn't lose anything. Good luck!
Yikes