Pelosi would only be president pro-tem until a convention of the states appointed a new president. The new president would then have to nominate a vice president who would have to be confirmed by the senate.
Actually, the "President Pro-tempore" is in essence, the "VP" of the Senate and 3rd in the line of succession. So, unless Pelosi magically becomes a Senator... (President ---> Vice President --> Speaker of the House --> President Pro-tem of Senate ---> Cabinet members in the order of their seniority).... It's why, during the SOTU address, one of the cabinet members has to be absent from the House Chamber... Just in case.....