If you are still on the ride with your Japan Rail Pass [JR Pass] when the Pass expires at the midnight, then the Pass will be valid on JR fares until you get out through the station gate for the first time. However, a JR Pass primarily does not cover any charge for a ride of utilizing a berth; in that case a JR Pass covers fare(s) only.
The Hokutosei has sorts of berth spaces, but it usually does not have seats; you will have to pay in advance at least 9,190 yen charges ( = Ltd. Express and berth charge).
And, the Hokutosei runs via two non-JR sections; so you will also have to pay 2,960 yen fares for the sections while you are aboard the train.
- Japan Rail Pass: Notes regarding use
Item 4 (including a word "berth") fully applies to your case.
Item 5 (including a word "overnight") is to be an answer to the core of your original questions.
//