We've done the Perth to KL leg with AirAsia, but with going to Bangkok we've always picked the later flight. We've done this about 4 times and each time we could have made it onto the earlier time like yours and spewing that we've had to wait hours at the airport.
Agree with TravellingMItch on times. I have noticed though that they don't give out immigration cards for KL on the plane anymore. So when you arrive there is a rush for everyone filling in the cards. Lucky me I always have a handful of spare ones that I fill in at home before I leave.
Also if you only have hand luggage then the process is quick.
Another thing is if you do a web check in for the Bangkok flight, this saves time, as there is usually 2 lines (1 for web check in's which is quick and the other line for people that haven't done a web check in) .