If the flight is operated by UA, mileage and PQP will be accrued based on the ticket price of the segment, however it is calculated.
For the remaining segments on LH, if they are not on a 016 ticket, then yes it will be based on the number of miles earned, with PQP calculated based on the miles.
If a segment is upgraded via instrument, the number of miles will be earned based on the original booking class.