There is limited service on the Q31 bus ($2.25), and they do not run late, so I would not take it at 10:00pm. However, I think taking it at 2:30 will be fine (you might just have to wait a bit).
To get to the Jamaica station from the Airport, you need to take the JFK Airtran ($5) to the Jamaica station; it will take approximately 15-20 minutes from what I can remember. To get to Bayside from Jamaica, I would say that will take another 20 minutes or so. So just to be safe, I would say the trip will take 45 minutes or so, and taking a cab is always a good option too if you don't want to deal with this...
There is limited service on