Depends how safe you want to play it. Last train leaves at 0:48. It takes about 30 min to the airport and then another 20-30 to get to the gate. You need to be there 20 min before the flight. This means you need to take a train not later than 0:10.
Assuming you flight is on time and immigration is not too bad you will be at Hong Kong station around 23:10-23:20.