The one who engaged in foreplay with his wife until he ejaculated has to make up the fast but he does not have to offer expiation
You did well to break your fast when you were very sick, and you also did well to fast when you thought that you were able to, although it would have been better to consult the doctor. So long as you fasted that day and were not harmed by fasting, then you have to make up that day.
There is no reason why a man should not engage in foreplay with his wife when fasting, if he is confident that he will not spoil his fast or hers. But if he is not confident of that then it is not permissible for him to do it.
Al-‘Allaamah Mustafa al-Ruhaybaani said in Mataalib Ooli al-Nuha (2/204): Things like kissing are also forbidden, such as embracing, touching, and repeatedly looking for one who thinks that he may ejaculate, and there is no scholarly difference of opinion on this point. End quote.
If you engaged in foreplay with your wife and felt confident that it would not spoil your fast, then there is no sin on you for this foreplay even if it did spoil your fast.
But if you thought that you would ejaculate, then you sinned by engaging in this foreplay, and you have to repent to Allaah.
With regard to fasting, the fast is spoiled in either case, because you ejaculated, whether you intended to break the fast or not. Shaykh Muhammad ibn ‘Uthaymeen (may Allaah have mercy on him) said: If he was intimate with his wife, whether by touching or kissing and so on (less than intercourse), then if he ejaculates his fast is invalidated, but if he does nor ejaculate then he does not break the fast thereby. End quote from al-Sharh al-Mumti’ (6/388).
You have to fast one day to make up for this day, but you do not have to offer any expiation. Al-Nawawi (may Allaah have mercy on him) said in al-Majmoo’ (6/377); If he spoils his fast with something other than intercourse, such as eating, drinking, masturbating or foreplay that leads to ejaculation, then there is no expiation because the text speaks only of intercourse, and these things do not come under the same heading. End quote.
And Allaah knows best.