A_ This adverbial locution does not seem quite proper in this context, but this elusive feeling can be explained to a certain extent. The reason is that it is used to express a judgement relative to a point on a given scale and that the scale that is implied is not usual (but in principle not unreal).
time_ à peine 5 heure (it is not yet the time for going to bed)
size_ à peine 5 kilogrammes (it big for a turkey, but not too big)
age_ à peine quarante ans (that is not enough to call her old)
vitesse_ à peine à cinquante à l'heure (ils n'ont pas pu avoir un accident grave à cette vitesse)
You can apply it to "a while's rest" as you can consider "a while's rest" as a point on a scale (although not as nice a scale as those above) -- it'll have to be the scale of the possible durations of a resting period --
- possible durations of a resting period_ à peine un moment de repos
B_ The place of the locution is without contest correct if right before what it modifies.
- J'ai l'impression qu'il lui a été donné à peine une légère punition.
These next possibilities of placing it among the parts of the verb seem equally likely but they are objectionable as adverbs and adverbial locutions are modifiers of nouns, adjectives, and verbs.
- Je crois qu'il a fini à peine son dessert. (He finished his dessert but not much of anything else.)
- Je crois qu'il a à peine fini son dessert. (He's just finished his dessert.)