We report theoretical and numerical results on bifurcations in thermal instability for a viscoelastic fluid saturating a porous square cavity heated from below. The modified Darcy law based on the Oldroyd-B model was used for modeling the momentum equation. In addition to Rayleigh number ℜ, two more dimensionless parameters are introduced, namely, the relaxation time λ1 and the retardation time λ2. Temporal stability analysis showed that the first bifurcation from the conductive state may be either oscillatory for sufficiently elastic fluids or stationary for weakly elastic fluids. The dynamics associated with the nonlinear interaction between the two kinds of instabilities is first analyzed in the framework of a weakly nonlinear theory. For sufficiently elastic fluids, analytical expressions of the nonlinear threshold above which a second hysteretic bifurcation from oscillatory to stationary convective pattern are derived and found to agree with two-dimensional numerical simulations of the full equations. Computations performed with high Rayleigh number indicated that the system exhibits a third transition from steady single-cell convection to oscillatory multi-cellular flows. Moreover, we found that an intermittent oscillation regime may exist with steady state before the emergence of the secondary Hopf bifurcation. For weakly elastic fluids, we determined a second critical value ℜ2Osc(λ1,λ2) above which a Hopf bifurcation from steady convective pattern to oscillatory convection occurs. The well known limit of ℜ2Osc(λ1=0,λ2=0)=390 for Newtonian fluids is recovered, while the fluid elasticity is found to delay the onset of the Hopf bifurcation. The major new findings were presented in the form of bifurcation diagrams as functions of viscoelastic parameters for ℜ up to 420.