Calling the TIMx_TimeBaseInit(... does not immediately change the prescaler - but waits for a fill cycle/UEV event.
May be useful to add a TIM2->EGR = 1; to trigger an update event to change the prescaler (See note 17.7.17 in the reference manual) in that function. Or have a flag for this.