I ran out of PP of one of my moves and then I used Rest and Sleep Talk and Sleep Talk used one of my attacking moves, but if it was out of PP how does it work?
Same as before, but the list of moves that cannot be selected has increased. Sleep Talk now works multiple times if used while holding a choice item. Sleep Talk can call and successfully execute a move that is disabled or has no PP remaining. Sleep Talk will not select itself or any of the following moves:
So don't worry, this is not a glitch. This is very well possibly, so Sleep Talk can summon moves with both PP and not :)
Source