How long can I keep a dessert out of the fridge?
Since it is a custard, you should probably refrigerate it as soon as it is cool.

A very sugary or acidic custard may be able to resist bacteria for a couple days (see Bismark donuts), but unless the recipe was specifically developed to be stable at room temperature, then there is some risk of it going bad.

If you have a fridge, there's no reason not to use it.  It may make the dough a little soggy, so you will want to find a way to store it to reduce condensation.

Better yet, make just as much as you are going to eat/serve at one time, and don't worry about this problem.

Link 1 (search for custard on page)

Link 2 (about pies, see portion on Custard pies)