Biomedical studies often monitor subjects using a longitudinal marker that may be informative about a time-to-event outcome of interest. Examples are periodic monitoring of prostate specific antigen (PSA) as the longitudinal marker and time to onset of prostate cancer, and CD4 cell count as marker together with time to death from AIDS. Models that handle the two outcomes jointly and take advantage of their dependence have potential to improve inference for each. We develop a fully Bayesian joint longitudinal-survival model that uses a latent class structure to facilitate discovery of subgroups exhibiting distinct behavior. Subgroups may vary according to covariate effects, for example, time trends or the degree of response to intervention in the context of a clinical trial. Our formulation incorporates estimation of the number of subgroups and offers enhanced flexibility with a subgroup-specific piecewise linear log baseline hazard. We derive the correlation between the longitudinal and survival outcomes induced in our formulation and graphically display this dependence. We further derive prediction of the survival end point conditional on the observed longitudinal marker. Using simulation, we demonstrate the ability of our joint model to recover the true number of subgroups in the population and evaluate prediction of survival. Analysis of data from an AIDS clinical trial illustrates the model and suggests greater precision than prior analyses in the literature.